Class: Tabry::ConfigBuilder::TopLevelBuilder

Inherits:
SubBuilder show all
Defined in:
lib/tabry/config_builder/top_level_builder.rb

Instance Attribute Summary

Attributes inherited from GenericBuilder

#_opts

Instance Method Summary collapse

Methods inherited from SubBuilder

#_include

Methods inherited from GenericBuilder

#_append, #_augment_list_item, #_build, #_include, #_obj, #_set, #_set_hash, #_split_name_to_aliases, build, builder_appender, #include, init_setters, #initialize, simple_setter

Constructor Details

This class inherits a constructor from GenericBuilder

Instance Method Details

#completionObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/tabry/config_builder/top_level_builder.rb', line 23

def completion
  sub :completion do
    desc "Get tab completion shell config"
    sub :json, "Get flattened tabry JSON config for command (experimental)"
    sub :bash, "Get tab completion for bash or zsh"
    sub :fish, "Get tab completion for fish"
    arg :cmd_line, "(for internal usage, when used instead of subcommand) full command line for getting completion options"
    arg :comp_point, "(for internal usage, when used instead of subcommand) comp point"
  end
end

#defargs(name, &blk) ⇒ Object



11
12
13
14
15
# File 'lib/tabry/config_builder/top_level_builder.rb', line 11

def defargs(name, &blk)
  name = name.to_s.gsub(/^@/, "")
  name = name.gsub("_", "-") if _opts[:names_underscores_to_dashes]
  _set_hash :arg_includes, name, _build(SubBuilder, &blk)
end

#defopts(name, &blk) ⇒ Object



17
18
19
20
21
# File 'lib/tabry/config_builder/top_level_builder.rb', line 17

def defopts(name, &blk)
  name = name.to_s.gsub(/^@/, "")
  name = name.gsub("_", "-") if _opts[:names_underscores_to_dashes]
  _set_hash :option_includes, name, _build(ArgOrFlagBuilder, &blk)["options"]
end