Class: DevSnap::Cli::CliManager
- Inherits:
-
Object
- Object
- DevSnap::Cli::CliManager
- Includes:
- TR::ArgUtils, TR::CondUtils
- Defined in:
- lib/dev_snap/cli_manager.rb
Instance Method Summary collapse
- #derive_action(a) ⇒ Object
-
#initialize(pmt) ⇒ CliManager
constructor
A new instance of CliManager.
Constructor Details
#initialize(pmt) ⇒ CliManager
Returns a new instance of CliManager.
15 16 17 |
# File 'lib/dev_snap/cli_manager.rb', line 15 def initialize(pmt) @pmt = pmt end |
Instance Method Details
#derive_action(a) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/dev_snap/cli_manager.rb', line 19 def derive_action(a) @pmt.puts "\n DevSnap version #{DevSnap::VERSION}".yellow ops = a.first case ops.downcase when 'snap-root', 'root' root = action_set_snap_root(a[1..-1]) @pmt.puts "\n Snap root is set at : #{root}\n".green when 'add', 'a' ws = action_add(a[1..-1]) @pmt.puts "\n Workspace '#{ws}' is added to monitoring list\n".green when 'forget','ignore' action_forget(a[1..-1]) @pmt.puts "\n Workspace '#{ws}' is removed from monitoring list\n".yellow when 'list', 'l' action_list when 'run','r' start, done, duration = action_run @pmt.puts "Run starts on #{start} and ends on #{done}. Took #{duration} seconds" else logger.debug "Unknown action '#{ops.downcase}" end [true, []] end |