module GitProc::GitProcessOptions
Constants
- DEBUG
Public Instance Methods
description()
click to toggle source
# File lib/git-process/git_process_options.rb, line 78 def description 'Default description' end
empty_argv_ok?()
click to toggle source
# File lib/git-process/git_process_options.rb, line 83 def empty_argv_ok? true end
extend_opts(parser)
click to toggle source
noinspection RubyUnusedLocalVariable
# File lib/git-process/git_process_options.rb, line 89 def extend_opts(parser) # extension point - does nothing by default end
parse_cli(filename, argv)
click to toggle source
# File lib/git-process/git_process_options.rb, line 24 def parse_cli(filename, argv) parser = Trollop::Parser.new parser.version "#{filename} #{GitProc::Version::STRING}" #parser.banner "#{summary}\n\n" command_name = filename.sub(/git-/, '') parser.banner "For full documentation, see 'git help #{command_name}'" parser.banner "" extend_opts(parser) standard_opts(parser) #parser.banner "\n#{description}" opts = Trollop::with_standard_exception_handling parser do raise Trollop::HelpNeeded if ARGV.empty? and !empty_argv_ok? parser.parse argv end opts[:info] = false if opts[:verbose] || opts[:quiet] opts[:info] = true if opts[:info_given] post_parse(opts, argv) if DEBUG puts "\n\n#{opts.map { |k, v| "#{k}:#{v}" }.join(', ')}" puts "\nargs: #{argv.join(', ')}" end opts end
post_parse(opts, argv)
click to toggle source
noinspection RubyUnusedLocalVariable
# File lib/git-process/git_process_options.rb, line 95 def post_parse(opts, argv) # extension point - does nothing by default end
standard_opts(parser)
click to toggle source
# File lib/git-process/git_process_options.rb, line 57 def standard_opts(parser) parser.opt :info, 'Informational messages; show the major things this is doing', :default => true, :short => :none parser.opt :quiet, 'Quiet messages; only show errors', :short => :q parser.opt :verbose, 'Verbose messages; show lots of details on what this is doing', :short => :v parser.opt :version, "Print version (#{GitProc::Version::STRING}) and exit", :short => :none parser.opt :help, 'Show this message', :short => :h parser.conflicts :verbose, :info, :quiet end
summary()
click to toggle source
# File lib/git-process/git_process_options.rb, line 68 def summary 'Default summary' end
usage(filename)
click to toggle source
# File lib/git-process/git_process_options.rb, line 73 def usage(filename) "#{filename} [options]" end