#!/usr/bin/env ruby require 'gli' require 'pgit' include GLI::App program_desc 'Optimize your Pivotal Tracker and Git workflow' version Pgit::VERSION subcommand_option_handling :normal arguments :strict # desc 'Path to the config file' # default_value "#{ENV['HOME']}/.pgit.rc.yml" # arg_name '/path/to/.pivotal.yml' # flag [:c,:config] # desc 'Bypasses the app asking for confirmation' # switch [:force] # desc 'PivotalTracker API Token' # arg_name 'secr3tT0ken123' # flag [:'api-token'] desc "Installs the pgit configuration file" command :install do |c| c.action do |global_options,options,args| PGit::Installer.new(global_options, options, args) end end # desc 'Start, finish, etc. Pivotal Tracker story branches' desc 'Start Pivotal Tracker story branches' long_desc "Makes a cURL request to Pivotal Tracker to fetch the story, based on the given story id, parses the title, appends it with the story id. It then creates a branch name with that parsed title and does a `git checkout` to it. " command :story_branch do |c| c.desc "Parses the title of the given Pivotal Tracker story,\n" + " makes the branch name, and does a checkout" c.arg_name 'STORY_ID' c.flag :s, :start # c.desc "Merge back to staging, remove local and remote (origin?) branches" # c.switch :f, :finish # c.desc "Attempts to join the story-branch that, presumably, already exists" # c.arg_name 'STORY_ID' # c.flag :j, :join c.action do |global_options,options,args| PGit::StoryBranch::Application.new(global_options, options, args) end end # desc 'Wraps `git commit -m` and prepends the message with story id of the branch' # command :commit do |c| # arg_name 'Describe arguments to commit here' # c.action do |global_options,options,args| # puts "commit command ran" # end # end desc 'Initializes configuration file' arg_name 'path/to/config_file' # command :init_config do |c| # c.action do |global_options,options,args| # puts "init_config command ran" # end # end pre do |global,command,options,args| # Pre logic here # Return true to proceed; false to abort and not call the # chosen command # Use skips_pre before a command to skip this block # on that command only true end post do |global,command,options,args| # Post logic here # Use skips_post before a command to skip this # block on that command only end on_error do |exception| # Error logic here # return false to skip default error handling true end exit run(ARGV)