Module: BundleSafeUpdate::CLI::Options
- Included in:
- BundleSafeUpdate::CLI
- Defined in:
- lib/bundle_safe_update/cli/options.rb
Instance Method Summary collapse
- #build_option_parser(options) ⇒ Object
- #define_basic_config_options(opts, options) ⇒ Object
- #define_config_options(opts, options) ⇒ Object
- #define_info_options(opts) ⇒ Object
- #define_output_options(opts, options) ⇒ Object
- #define_skip_options(opts, options) ⇒ Object
Instance Method Details
#build_option_parser(options) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/bundle_safe_update/cli/options.rb', line 6 def build_option_parser() OptionParser.new do |opts| opts. = 'Usage: bundle-safe-update [options] [gem1 gem2 ...]' (opts, ) (opts, ) (opts) end end |
#define_basic_config_options(opts, options) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/bundle_safe_update/cli/options.rb', line 20 def (opts, ) opts.on('--config PATH', 'Path to config file') { |path| [:config] = path } opts.on('--cooldown DAYS', Integer, 'Minimum age in days') { |days| [:cooldown] = days } opts.on('--update', 'Update gems that pass the cooldown check') { [:update] = true } opts.on('--lock-only', 'Update Gemfile.lock without installing gems') { [:lock_only] = true } opts.on('--warn-only', 'Report violations but exit with success') { [:warn_only] = true } opts.on('--dry-run', 'Show configuration without checking') { [:dry_run] = true } end |
#define_config_options(opts, options) ⇒ Object
15 16 17 18 |
# File 'lib/bundle_safe_update/cli/options.rb', line 15 def (opts, ) (opts, ) (opts, ) end |
#define_info_options(opts) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bundle_safe_update/cli/options.rb', line 40 def (opts) opts.on('-v', '--version', 'Show version') do puts("bundle-safe-update #{VERSION}") exit(EXIT_SUCCESS) end opts.on('-h', '--help', 'Show this help') do puts(opts) exit(EXIT_SUCCESS) end end |
#define_output_options(opts, options) ⇒ Object
35 36 37 38 |
# File 'lib/bundle_safe_update/cli/options.rb', line 35 def (opts, ) opts.on('--json', 'Output in JSON format') { [:json] = true } opts.on('--verbose', 'Enable verbose output') { [:verbose] = true } end |
#define_skip_options(opts, options) ⇒ Object
29 30 31 32 33 |
# File 'lib/bundle_safe_update/cli/options.rb', line 29 def (opts, ) opts.on('--no-audit', 'Skip vulnerability audit') { [:audit] = false } opts.on('--no-risk', 'Skip risk signal checking') { [:risk] = false } opts.on('--refresh-cache', 'Refresh owner cache without warnings') { [:refresh_cache] = true } end |