Class: HarvestWorklog::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/harvest_worklog.rb

Class Method Summary collapse

Class Method Details

.run(arguments, output: $stdout, error: $stderr, client: nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/harvest_worklog.rb', line 30

def self.run(arguments, output: $stdout, error: $stderr, client: nil)
  command, *command_arguments = arguments
  case command
  when "time-off"
    TimeOffCLI.run(command_arguments, output:, error:, client:)
  when "work-entry"
    WorkEntryCLI.run(command_arguments, output:, error:, client:)
  when "-h", "--help"
    output.puts usage
    0
  else
    error.puts "Error: choose time-off or work-entry"
    error.puts usage
    1
  end
end

.usageObject



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/harvest_worklog.rb', line 47

def self.usage
  <<~USAGE
    Usage:
      harvest-worklog time-off FROM TO --project NAME --task NAME [options]
      harvest-worklog work-entry DATE --project NAME --task NAME --hours HOURS --notes NOTES [options]

    Commands:
      time-off    Create one entry per local business day in a date range.
      work-entry  Create one reviewed ordinary-work entry.
  USAGE
end