Class: WIP::CLI::Shell

Inherits:
Thor
  • Object
show all
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

#behavior

Attributes included from Thor::Base

#options

Instance Method Summary collapse

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

#initialize(*args) ⇒ Shell

Returns a new instance of Shell.



17
18
19
20
21
22
23
# File 'lib/wip/cli.rb', line 17

def initialize(*args)
  super
  use_shell = options["no-color"] ? Thor::Shell::Basic.new : shell

  WIP.ui = UI::Shell.new(use_shell)
  Gem::DefaultUserInteraction.ui = UI::RGProxy.new(WIP.ui)
end

Instance Method Details

#index(path = nil) ⇒ Object



31
32
33
34
35
36
# File 'lib/wip/cli.rb', line 31

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

#show(path = nil) ⇒ Object



42
43
44
45
# File 'lib/wip/cli.rb', line 42

def show(path = nil)
  @_show ||= WIP::CLI::Show.new(path || '.')
  @_show.get
end