Class: TheFox::Timr::Command::HelpCommand
- Inherits:
-
BasicCommand
- Object
- BasicCommand
- TheFox::Timr::Command::HelpCommand
- Defined in:
- lib/timr/command/help_command.rb
Overview
Print the overview help page.
Instance Attribute Summary
Attributes inherited from BasicCommand
Class Method Summary collapse
-
.print_datetime_help ⇒ Object
Print DateTime help.
-
.print_estimation_help(ext = false) ⇒ Object
Print Estimation help.
-
.print_id_help ⇒ Object
Alias.
-
.print_man_units_help ⇒ Object
Print Man Units help.
-
.print_task_id_help ⇒ Object
Print help about Task ID.
-
.print_track_id_help ⇒ Object
Print help about Track ID.
Instance Method Summary collapse
-
#initialize(argv = Array.new) ⇒ HelpCommand
constructor
A new instance of HelpCommand.
-
#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) ⇒ HelpCommand
Returns a new instance of HelpCommand.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/timr/command/help_command.rb', line 9 def initialize(argv = Array.new) # puts "help #{argv}" super() @command_opt = nil loop_c = 0 # Limit the loop. while loop_c < 1024 && argv.length > 0 loop_c += 1 unless @command_opt @command_opt = argv.shift end end end |
Class Method Details
.print_datetime_help ⇒ Object
Print DateTime help.
65 66 67 68 69 70 71 |
# File 'lib/timr/command/help_command.rb', line 65 def print_datetime_help puts 'DateTime Formats' puts " <date_time> A DateTime is one single string" puts " representing '<date> <time>'." puts ' <date> Formats: YYYYMMDD, YYYY-MM-DD, MM/DD/YYYY, DD.MM.YYYY' puts ' <time> Formats: HH:MM, HH:MM:SS' end |
.print_estimation_help(ext = false) ⇒ Object
Print Estimation help.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/timr/command/help_command.rb', line 74 def print_estimation_help(ext = false) puts 'Duration' puts ' Duration is parsed by chronic_duration.' puts ' Examples:' puts " -e 2:10:5 # Sets Estimation to 2h 10m 5s." puts " -e '2h 10m 5s' # Sets Estimation to 2h 10m 5s." puts if ext puts " Use '+' or '-' to calculate with Estimation Times:" puts " -e '-45m' # Subtracts 45 minutes from the original Estimation." puts " -e '+1h 30m' # Adds 1 hour 30 minutes to the original Estimation." puts end puts ' See chronic_duration for more examples.' puts ' https://github.com/henrypoydar/chronic_duration' end |
.print_id_help ⇒ Object
Alias
45 46 47 48 49 |
# File 'lib/timr/command/help_command.rb', line 45 def print_id_help print_task_id_help puts print_track_id_help end |
.print_man_units_help ⇒ Object
Print Man Units help.
92 93 94 95 96 |
# File 'lib/timr/command/help_command.rb', line 92 def print_man_units_help puts 'Man Units' puts ' 8 hours are 1 man-day.' puts ' 5 man-days are 1 man-week, and so on.' end |
.print_task_id_help ⇒ Object
Print help about Task ID.
52 53 54 55 |
# File 'lib/timr/command/help_command.rb', line 52 def print_task_id_help puts ' <task_id> Task ID (SHA1 hex)' puts ' If not specified a new Task will be created.' end |
.print_track_id_help ⇒ Object
Print help about Track ID.
58 59 60 61 62 |
# File 'lib/timr/command/help_command.rb', line 58 def print_track_id_help puts ' <track_id> Track ID (SHA1 hex)' puts ' If specified a new Track with the same' puts ' message will be created.' end |
Instance Method Details
#run ⇒ Object
See BasicCommand#run.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/timr/command/help_command.rb', line 27 def run if @command_opt command_class = BasicCommand.get_command_class_by_name(@command_opt) if defined?(command_class::MAN_PATH) system("man #{command_class::MAN_PATH}") else raise HelpCommandError, "No manual page found for '#{@command_opt}'. See 'timr --help'." end else help end end |