Code Coverage
 
Lines
Covered
22.35% covered (danger)
22.35%
19 / 85
1
module TheFox
1
module Timr
1
module Command
# Print the overview help page.
1
class HelpCommand < BasicCommand
1
def initialize(argv = Array.new)
# puts "help #{argv}"
1
super()
1
@command_opt = nil
1
loop_c = 0 # Limit the loop.
1
while loop_c < 1024 && argv.length > 0
0
loop_c += 1
0
unless @command_opt
0
@command_opt = argv.shift
end
end
end
# See BasicCommand#run.
1
def run
0
if @command_opt
0
command_class = BasicCommand.get_command_class_by_name(@command_opt)
0
if defined?(command_class::MAN_PATH)
0
system("man #{command_class::MAN_PATH}")
else
0
raise HelpCommandError, "No manual page found for '#{@command_opt}'. See 'timr --help'."
end
else
0
help
end
end
# All methods in this block are static.
1
class << self
# Alias
1
def print_id_help
0
print_task_id_help
0
puts
0
print_track_id_help
end
# Print help about Task ID.
1
def print_task_id_help
0
puts ' <task_id> Task ID (SHA1 hex)'
0
puts ' If not specified a new Task will be created.'
end
# Print help about Track ID.
1
def print_track_id_help
0
puts ' <track_id> Track ID (SHA1 hex)'
0
puts ' If specified a new Track with the same'
0
puts ' message will be created.'
end
# Print DateTime help.
1
def print_datetime_help
0
puts 'DateTime Formats'
0
puts " <date_time> A DateTime is one single string"
0
puts " representing '<date> <time>'."
0
puts ' <date> Formats: YYYYMMDD, YYYY-MM-DD, MM/DD/YYYY, DD.MM.YYYY'
0
puts ' <time> Formats: HH:MM, HH:MM:SS'
end
# Print Estimation help.
1
def print_estimation_help(ext = false)
0
puts 'Duration'
0
puts ' Duration is parsed by chronic_duration.'
0
puts ' Examples:'
0
puts " -e 2:10:5 # Sets Estimation to 2h 10m 5s."
0
puts " -e '2h 10m 5s' # Sets Estimation to 2h 10m 5s."
0
puts
0
if ext
0
puts " Use '+' or '-' to calculate with Estimation Times:"
0
puts " -e '-45m' # Subtracts 45 minutes from the original Estimation."
0
puts " -e '+1h 30m' # Adds 1 hour 30 minutes to the original Estimation."
0
puts
end
0
puts ' See chronic_duration for more examples.'
0
puts ' https://github.com/henrypoydar/chronic_duration'
end
# Print Man Units help.
1
def print_man_units_help
0
puts 'Man Units'
0
puts ' 8 hours are 1 man-day.'
0
puts ' 5 man-days are 1 man-week, and so on.'
end
end
1
private
1
def help
0
puts 'usage: timr [-V|--version] [-h|--help] [-C <path>] <command> [<args>]'
0
puts
0
puts ' -V, --version Show version.'
0
puts ' -h, --help Show help.'
0
puts ' -C <path> Set path to the project base directory.'
0
puts ' Default: ~/.timr/defaultc'
0
puts
0
puts 'Commands'
0
puts ' start Start working on a Task.'
0
puts ' stop Stop the current running Task/Track.'
0
puts
0
puts ' pause Pause the Top Track of the Stack.'
0
puts ' continue Continue the Top Track of the Stack.'
0
puts
0
puts ' push Push a new Track on the Stack and pause the old one.'
0
puts ' pop Pop the Top Track and continue the old one.'
0
puts
0
puts ' status Show the current Stack.'
0
puts ' log Show recent Tracks.'
0
puts
0
puts " task Task related commands. See 'timr task --help'."
0
puts " track Track related commands. See 'timr track --help'."
0
puts
0
puts ' report Generate a report.'
0
puts
0
puts "See 'timr <command> --help' to read details about a specific command,"
0
puts " or 'timr help <command>' to open the man page for this command."
0
puts "Also see 'man' directory for available man pages."
end
end # class HelpCommand
end # module Command
end # module Timr
end # module TheFox