Class: Metaclean::CLI
- Inherits:
-
Object
- Object
- Metaclean::CLI
- Defined in:
- lib/metaclean/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/metaclean/cli.rb', line 11 def initialize(argv) @argv = argv.dup @options = { recursive: false, in_place: false, force: false, inspect_only: false, dry_run: false, quiet: false, allow_icc_metadata: false, redact_values: !$stdout.tty? } @paths = [] end |
Class Method Details
.start(argv) ⇒ Object
7 8 9 |
# File 'lib/metaclean/cli.rb', line 7 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/metaclean/cli.rb', line 26 def run parse! Display.configure(quiet: @options[:quiet], redact_values: @options[:redact_values]) Metaclean.ensure_tools!(in_place: @options[:in_place]) runner = Runner.new(@options) if @options[:inspect_only] runner.inspect_paths(@paths) else runner.clean_paths(@paths) end rescue ToolsMissing => e warn Display.error('Missing required tools') warn e. exit 2 rescue Error, SystemCallError => e warn Display.error(e.) exit 1 rescue Interrupt warn "\n#{Display.error('Interrupted.')}" exit 130 end |