Method: MyPrecious.common_program_args

Defined in:
lib/myprecious.rb

.common_program_args(parser, args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/myprecious.rb', line 28

def self.common_program_args(parser, args)
  parser.on(
    '-o', '--out FILE',
    "Output file to generate",
  ) {|fpath| args.output_file = Pathname(fpath)}
  
  args.target = Pathname.pwd
  parser.on(
    '-C', '--dir PATH',
    "Path to inspect",
  ) do |fpath|
    fpath = Pathname(fpath)
    parser.invalid_args!("#{fpath} does not exist.") unless fpath.exist?
    args.target = fpath
    CVEs.config_dir = fpath
  end
  
  parser.on(
    '--[no-]cache',
    "Control caching of dependency information"
  ) {|v| MyPrecious.caching_disabled = v}
end