lib/modulesync/cli.rb in modulesync-0.2.0 vs lib/modulesync/cli.rb in modulesync-0.3.0

- old
+ new

@@ -8,14 +8,14 @@ def defaults { :namespace => 'puppetlabs', :branch => 'master', - :git_user => 'git', - :git_provider_address => 'github.com', + :git_base => 'git@github.com:', :managed_modules_conf => 'managed_modules.yml', :configs => '.', + :tag_pattern => '%s', } end def commands_available [ @@ -33,11 +33,11 @@ def parse_opts(args) @options = defaults @options.merge!(Hash.transform_keys_to_symbols(Util.parse_config(MODULESYNC_CONF_FILE))) @options[:command] = args[0] if commands_available.include?(args[0]) opt_parser = OptionParser.new do |opts| - opts.banner = "Usage: msync update [-m <commit message>] [-c <directory> ] [--noop] [-n <namespace>] [-b <branch>] [-f <filter>] | hook activate|deactivate [-c <directory> ] [-n <namespace>] [-b <branch>]" + opts.banner = "Usage: msync update [-m <commit message>] [-c <directory> ] [--noop] [--bump] [--changelog] [--tag] [--tag-pattern <tag_pattern>] [-n <namespace>] [-b <branch>] [-f <filter>] | hook activate|deactivate [-c <directory> ] [-n <namespace>] [-b <branch>]" opts.on('-m', '--message <msg>', 'Commit message to apply to updated modules') do |msg| @options[:message] = msg end opts.on('-n', '--namespace <url>', @@ -54,18 +54,42 @@ end opts.on('-f', '--filter <filter>', 'A regular expression to filter repositories to update.') do |filter| @options[:filter] = filter end + opts.on('--amend', + 'Amend previous commit') do |msg| + @options[:amend] = true + end + opts.on('--force', + 'Force push amended commit') do |msg| + @options[:force] = true + end opts.on('--noop', 'No-op mode') do |msg| @options[:noop] = true end + opts.on('--bump', + 'Bump module version to the next minor') do |msg| + @options[:bump] = true + end + opts.on('--changelog', + 'Update CHANGELOG.md if version was bumped') do |msg| + @options[:changelog] = true + end + opts.on('--tag', + 'Git tag with the current module version') do |msg| + @options[:tag] = true + end + opts.on('--tag-pattern', + 'The pattern to use when tagging releases.') do |pattern| + @options[:tag_pattern] = pattern + end @options[:help] = opts.help end.parse! @options.fetch(:message) do - if @options[:command] == 'update' && ! @options[:noop] + if @options[:command] == 'update' && ! @options[:noop] && ! @options[:amend] fail("A commit message is required unless using noop.") end end @options.fetch(:command) do