Class: TheFox::Timr::Command::ResetCommand
- Inherits:
-
BasicCommand
- Object
- BasicCommand
- TheFox::Timr::Command::ResetCommand
- Includes:
- Error
- Defined in:
- lib/timr/command/reset_command.rb
Overview
Remove current running Track. Paused commands will not be deleted.
Man page: [timr-reset(1)](../../../../man/timr-reset.1.html)
Constant Summary collapse
- MAN_PATH =
Path to man page.
'man/timr-reset.1'
Instance Attribute Summary
Attributes inherited from BasicCommand
Instance Method Summary collapse
-
#initialize(argv = Array.new) ⇒ ResetCommand
constructor
A new instance of ResetCommand.
-
#run ⇒ Object
See BasicCommand#run.
Methods inherited from BasicCommand
create_command_from_argv, get_command_class_by_name, #shutdown
Constructor Details
#initialize(argv = Array.new) ⇒ ResetCommand
Returns a new instance of ResetCommand.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/timr/command/reset_command.rb', line 18 def initialize(argv = Array.new) super() @help_opt = false @stack_opt = false loop_c = 0 # Limit the loop. while loop_c < 1024 && argv.length > 0 loop_c += 1 arg = argv.shift case arg when '-h', '--help' @help_opt = true when '-s', '--stack' @stack_opt = true else raise ResetCommandError, "Unknown argument '#{arg}'. See 'timr report --help'." end end end |
Instance Method Details
#run ⇒ Object
See BasicCommand#run.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/timr/command/reset_command.rb', line 41 def run if @help_opt help return end @timr = Timr.new(@cwd) track = @timr.stack.current_track if track && track.running? puts '--- RESET ---' puts track.to_compact_str puts end @timr.reset({:stack => @stack_opt}) puts @timr.stack end |