Sha256: e2a9efb60b796c3beffa4298bf6f4e7f3a486b3fea2a20c917a084ed7fb7ec05
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
require "optparse" module GitCurate class CLIParser attr_reader :parsed_options def initialize @parsed_options = {} end # Sets @parsed_options according to the options received, and return truthy # if and only if the program should continue after the options are passed. def parse(options) opt_parser = OptionParser.new do |opts| opts.banner = <<-EOF Usage: git curate [options] Interactively step through the local branches of the current git repository, showing various information and asking whether to keep or delete each branch. In the default (interactive) mode, the current branch is excluded, as it cannot be deleted. Note git-curate does not perform a "git fetch"; if you want to be sure the output reflects the current state of any remotes, run "git fetch" first. Options: EOF opts.on( "-l", "--list", "Show summary of local branches, including current branch, without stepping through interactively" ) do self.parsed_options[:list] = true end opts.on("-h", "Print this help message") do puts opts return false end opts.on("-v", "--version", "Print the currently installed version of this program") do puts "git curate v#{GitCurate::VERSION} #{GitCurate::COPYRIGHT}" return false end end opt_parser.parse!(options) return true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
git_curate-0.7.1 | lib/git_curate/cli_parser.rb |
git_curate-0.7.0 | lib/git_curate/cli_parser.rb |
git_curate-0.6.4 | lib/git_curate/cli_parser.rb |