Class: WIP::CLI::Shell
- Includes:
- Thor::Actions
- Defined in:
- lib/wip/cli.rb
Constant Summary
Constants inherited from Thor
Thor::HELP_MAPPINGS, Thor::THOR_RESERVED_WORDS, Thor::VERSION
Instance Attribute Summary
Attributes included from Thor::Actions
Attributes included from Thor::Base
Instance Method Summary collapse
- #back ⇒ Object
- #index(path = nil) ⇒ Object
-
#initialize(*args) ⇒ Shell
constructor
A new instance of Shell.
- #route(*args) ⇒ Object
- #show(path = nil) ⇒ Object
Methods included from Thor::Actions
#action, #append_file, #apply, #chmod, #copy_file, #create_file, #destination_root, #destination_root=, #directory, #empty_directory, #find_in_source_paths, #get, #gsub_file, #in_root, included, #inject_into_class, #inject_into_file, #inside, #prepend_file, #relative_to_original_destination_root, #remove_file, #run, #run_ruby_script, #source_paths, #template, #thor
Methods inherited from Thor
check_unknown_options!, check_unknown_options?, default_task, desc, #help, help, long_desc, map, method_option, method_options, printable_tasks, subcommand, subcommands, task_help
Methods included from Thor::Base
included, register_klass_file, shell, shell=, subclass_files, subclasses
Constructor Details
Instance Method Details
#back ⇒ Object
72 73 74 |
# File 'lib/wip/cli.rb', line 72 def back(*) WIP.ui.info ENV['WIP_BACK'] end |
#index(path = nil) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/wip/cli.rb', line 55 def index(path = nil, *) @_index ||= WIP::CLI::Index.new(path || '.') @_index.get(:sort => :name).each do |work| WIP.ui.info " * #{work[:name]}\n #{work[:path]}" end end |
#route(*args) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wip/cli.rb', line 35 def route(*args) @_all_tasks ||= self.class.all_tasks @_public_names ||= @_all_tasks.inject([]) do |memo, hash| memo << hash[0] unless hash[1].hidden? memo end # TODO: be sure we cannot loop (send :route) if @_public_names.include?(args.first) send(args.shift, *args) else # no matching task: see if there's a "work" to show show(*args) end end |