Sha256: 54555be192525fec75b52dfebdaffa5c92b64b9e37b34fa7c899ea2aeeb7aab3
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'optparse' require 'ostruct' module GitBumper # This is the parser for CLI arguments. class CLIParser attr_reader :options # @param argv [Array<String>] def initialize(argv) @argv = argv @parser = OptionParser.new @options = { klass: GitBumper::Tag, prefix: 'v', increment: :patch } end def parse @parser.banner = 'Usage: git bump [options]' @parser .on('-b', '--build', 'Use build tags') do options[:klass] = GitBumper::BuildTag end .on('-p', '--prefix [PREFIX]', 'Set a prefix') do |prefix| options[:prefix] = prefix end .on('--major', 'Increments the major version') do options[:increment] = :major end .on('--minor', 'Increments the minor version') do options[:increment] = :minor end .on('-h', '--help', 'Prints this help') do puts @parser exit end @parser.parse!(@argv) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_bumper-0.1.1 | lib/git_bumper/cli_parser.rb |