Module: BundlerDiff
- Defined in:
- lib/bundler_diff.rb,
lib/bundler_diff/cli.rb,
lib/bundler_diff/version.rb,
lib/bundler_diff/formatter/default.rb,
lib/bundler_diff/formatter/md_table.rb
Defined Under Namespace
Modules: Formatter Classes: CLI
Constant Summary collapse
- VERSION =
'0.6.1'
Class Method Summary collapse
- .formatters ⇒ Object
-
.parse_options(args) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.formatters ⇒ Object
11 12 13 14 15 16 |
# File 'lib/bundler_diff.rb', line 11 def formatters @formatters ||= { default: Formatter::Default, md_table: Formatter::MdTable } end |
.parse_options(args) ⇒ Object
rubocop:disable Metrics/MethodLength
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bundler_diff.rb', line 18 def (args) # rubocop:disable Metrics/MethodLength = {} opt = OptionParser.new opt. = 'Usage: bundle diff [options]' opt.on('-c', '--commit COMMIT', 'Specify a commit') { |val| [:commit] = val } formatter_desc = [ 'Choose a formatter', ' default', ' md_table' ] opt.on('-f', '--format FORMATTER', *formatter_desc) do |val| [:format] = val.to_sym end opt.on('--escape-json', 'Escape output as a JSON string') do |val| [:escape_json] = val end opt.on('--access-token ACCESS_TOKEN', 'Set access token for GitHub API') do |val| [:access_token] = val end opt.on('-v', '--version', 'Display the version') { [:version] = true } remaining_args = opt.parse(args) [:commit] ||= remaining_args.shift end |