module Timeless::CommandSyntax

Constants

APP_NAME

Public Class Methods

commands() click to toggle source

return a hash with all the commands and their options

# File lib/timeless/cli/command_syntax.rb, line 8
def self.commands
  h = Hash.new
  self.methods.each do |method|
    if method.to_s.include?("_opts") then
      h = h.merge(eval(method.to_s))
    end
  end
  return h
end

Private Class Methods

balance_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 385
    def self.balance_opts
      opts = Slop::Options.new
      opts.banner = "balance -- produce a report of clocked activities"

      opts.string "--from", "Start date for listing gaps"
      opts.string "--to", "End date for listing gaps"
      opts.string "--filter", "Consider only entries whose notes contain this string"


      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Produce a report organized by keys of clocked activities.

   Use --from and --to to restrict to a given time period.

   Use --filter to restrict entries whose notes match the filter criteria.
   You can use --filter, for instance, to extract all entries related to 
   a project "project_1", using "p:project_1"

EXAMPLES
   timeless balance --filter p:project_1
EOS
      return { balance: [opts, :balance, help] }
    end
clock_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 231
    def self.clock_opts
      opts = Slop::Options.new
      opts.banner = "clock [--start 'chronic expression'] [--stop|end 'chronic expression'] [--last] -- stop the active timer"

      opts.string "--start", "Start time, using chronic expression (use last stop time if not specified)"
      opts.string "--stop", "Stop time, using chronic expression (use now, if not specified)"
      opts.string "--end", "A synonym of stop"

      opts.boolean "--last", "Reuse notes of last clock"

      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Clock an entry.  Use this command when you want to catchup with activities you have not clocked.

   With no options, it will add an entry ending now and starting from the end of the last clocked
   entry.  You can change the start usin the --start option and the stop time with the --stop option.

EXAMPLES
   timeless clock 
   timeless clock --start 'five hours ago' --stop 'three hours ago' quick break
   timeless clock --end 'one hour ago' working on p:project
EOS
      return { clock: [opts, :clock, help] }
    end
console_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 40
    def self.console_opts
      opts = Slop::Options.new
      opts.banner = "console [options] -- Enter the console"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Invoke a console, from which you can more easily run
   #{APP_NAME} commands.

EXAMPLES
   #{APP_NAME} console
   #{APP_NAME}:000> command 
   ....
   #{APP_NAME}:001> another_command
   ...
   #{APP_NAME}:002>
EOS
      return { :console => [opts, :console, help] } 
    end
current_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 263
    def self.current_opts
      opts = Slop::Options.new
      opts.banner = "current -- show time elapsed since last start command"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Show time elapsed since last start command.

EXAMPLES
   timeless current
EOS
      return { current: [opts, :current, help] }
    end
export_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 416
    def self.export_opts
      opts = Slop::Options.new
      opts.banner = "export -- export timeless.csv to CSV"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Print data to CSV, with the following columns:

   - Start Date
   - Start Time
   - End Date
   - End Time
   - Duration in seconds
   - First project found in notes
   - First activity found in notes
   - First client found in notes
   - Notes attached to entry

EXAMPLES
   timeless export 
   timeless export > data.csv
EOS
      return { export: [opts, :export, help] }
    end
forget_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 176
    def self.forget_opts
      opts = Slop::Options.new
      opts.banner = "forget -- forget the last start command"

      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Forget the active timer (if any).

   Timeless protects your active timer (that is, the timer you start with "timeless start"
   command) and will complain if you try to overwrite it (e.g., by using another start
   command or if you specity the start with 'clock' or 'stop').

EXAMPLES
   timeless forget
EOS
      return { forget: [opts, :forget, help] }
    end
gaps_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 320
    def self.gaps_opts
      opts = Slop::Options.new
      opts.banner = "gaps -- report all gaps in you timesheets"

      opts.string "--from", "Start date for listing gaps"
      opts.string "--to", "End date for listing gaps"
      opts.integer "--interval", "Minimum interval to report (in minutes)"


      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   List all gaps in the timesheets (periods you have not clocked).

   Use --from and --to to limit your search.  

   Use --interval to report only gaps longer than a given interval.

EXAMPLES
   timeless gaps --interval 10
EOS
      return { gaps: [opts, :gaps, help] }
    end
help_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 84
    def self.help_opts
      opts = Slop::Options.new
      opts.banner = "help [command] -- print usage string"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Print help about a command

EXAMPLES
   #{APP_NAME} help
   #{APP_NAME} help process
EOS
      return { :help => [opts, :help, help] }
    end
last_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 282
    def self.last_opts
      opts = Slop::Options.new
      opts.banner = "last -- show last clocked entry"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Show last clocked entry.

EXAMPLES
   timeless last
EOS
      return { last: [opts, :last, help] }
    end
list_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 301
    def self.list_opts
      opts = Slop::Options.new
      opts.banner = "list key -- list all values assigned to a given tag (e.g., list all projects)"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   List all values recorded for a given tag (e.g., list all projects).

EXAMPLES
   timeless list p
EOS
      return { list: [opts, :list, help] }
    end
man_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 65
    def self.man_opts
      opts = Slop::Options.new
      opts.banner = "man -- print a manual page"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Print the README file of this gem

EXAMPLES
   #{APP_NAME} man
EOS
      return { :man => [opts, :man, help] }
    end
pom_opts() click to toggle source

APP SPECIFIC COMMANDS START HERE

# File lib/timeless/cli/command_syntax.rb, line 109
    def self.pom_opts
      opts = Slop::Options.new
      opts.banner = "pom [options] [notes] -- run a pomodoro timer"

      opts.boolean "--long", "Use a long timer (50 minutes)"
      opts.integer "--duration", "Duration of the pomodoro timer, in minutes"

      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Generate a sidecar file for the track(s) passed as input.

   Once created a sidecar file usually does not need to be regenerated.  You can
   use the `--force` option to cause the sidecar file to be rewritten.

EXAMPLES
   timeless pom
   timeless pom --long
EOS
      return { pom: [opts, :pom, help] }
    end
start_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 136
    def self.start_opts 
      opts = Slop::Options.new
      opts.banner = "start [--at chronic expression] [notes] -- start the timer"

      opts.string "--at", "Manually set the start time"

      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Start the timer: invoke this command when you want to record the actual
   start of a given activity.

   Use --at, if the start time is not "now".  If you specify notes, they
   will be used when you stop the activity.

   Notes are written in free text, but you can use the following tags to mark certain
   strings:

   p: to specify a project
   c: to specify a client
   a: to specify the activity

   So, for instance, you can write something like: "working on p:next_big_thing trying 
   to a:test function asked by c:john_smith"

   Tags are used when reporting and exporting.

EXAMPLES

     timeless start p:mobile_app c:john_smith a:testing
     timeless start --at 'thirty minutes ago'
EOS
      return { start: [opts, :start, help] }
    end
statement_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 349
    def self.statement_opts
      opts = Slop::Options.new
      opts.banner = "statement -- produce a list of clocked activities"

      opts.string "--from", "Start date for listing gaps"
      opts.string "--to", "End date for listing gaps"
      opts.string "--filter", "Consider only entries whose notes contain this string"


      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Produce a statement of clocked activities.

   Use --from and --to to restrict to a given time period.

   Use --filter to restrict entries whose notes match the filter criteria.
   You can use --filter, for instance, to extract all entries related to 
   a project "project_1", using "p:project_1"

EXAMPLES
   # extract all entries which have the string p:project_1 in the notes field
   # (that is, all entries related to project_1)
   timeless statement --filter p:project_1

   # extract all entries which have the word documentation in the notes field
   timeless statement --filter documentation
EOS
      return { statement: [opts, :statement, help] }
    end
stop_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 200
    def self.stop_opts
      opts = Slop::Options.new
      opts.banner = "stop [--start 'chronic expression'] [--stop|end|at 'chronic expression'] [--last] -- stop the active timer"

      opts.string "--start", "Start time, using chronic expression"

      opts.string "--stop", "Stop time, using chronic expression"
      opts.string "--at", "A synonym of stop"
      opts.string "--end", "A synonym of stop"

      opts.boolean "--last", "Reuse notes of last clock"

      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   Stop clocking, using notes, if specified.  Require a start time if there is no active timer.

EXAMPLES
   timeless stop 
   timeless stop working on p:project
   timeless stop --at 'one hour ago' working on p:project
   timeless stop --start 'three hours ago' forgot to start the timer when working on p:project
EOS
      return { stop: [opts, :stop, help] }
    end
version_opts() click to toggle source
# File lib/timeless/cli/command_syntax.rb, line 20
    def self.version_opts
      opts = Slop::Options.new
      opts.banner = "version -- print version information"
      help = <<EOS
NAME
   #{opts.banner}

SYNOPSYS
   #{opts.to_s}

DESCRIPTION
   return version information

EXAMPLES
   #{APP_NAME} version
   #{APP_NAME} version #{VERSION}
EOS
      return { :version => [opts, :version, help] }
    end