lib/herodot.rb in herodot-0.1.10 vs lib/herodot.rb in herodot-0.2.0

- old
+ new

@@ -16,24 +16,39 @@ program :name, 'herodot' program :version, Herodot::VERSION program :description, 'Tracks your work based on git branch checkouts' config = Herodot::Configuration.new + init_command(config) track_command(config) show_command(config) link_command(config) default_command :show run! end - TRACK_DESCRIPTION = 'This command sets up post commit and post checkout hooks'\ + INIT_DESCRIPTION = 'This command sets up post commit and post checkout hooks'\ ', that will log the current branch into the worklog file.'.freeze + def init_command(config) + command :init do |c| + c.syntax = 'herodot init [<repository path>]' + c.summary = 'Start tracking a repository' + c.description = INIT_DESCRIPTION + c.example 'Start tracking current repository', 'herodot init' + c.action do |args, _| + Herodot::Commands.init(args[0], config) + end + end + end + + TRACK_DESCRIPTION = 'This command tracks the current branch/commit in a repo '\ + 'and is called from the git hooks installed via `herodot init`.'.freeze def track_command(config) command :track do |c| - c.syntax = 'herodot track [<repository path>]' - c.summary = 'Start tracking a repository' + c.syntax = 'herodot track <repository path>' + c.summary = 'Record git activity in a repository (used internally)' c.description = TRACK_DESCRIPTION - c.example 'Start tracking current repository', 'herodot track' + c.example 'Record the latest branch name etc. to the worklog', 'herodot track .' c.action do |args, _| Herodot::Commands.track(args[0], config) end end end