Module: AstroSubframeOrganizer::Commands::SharedOptions

Included in:
Cleanup::EmptyDirectories, Cleanup::Thumbnails, Cleanup::Unorganize, Init, Organize::Base, Raw::RenameFromExif, Raw::RevertToRaw, Run
Defined in:
lib/astro_subframe_organizer/commands/shared_options.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/astro_subframe_organizer/commands/shared_options.rb', line 6

def self.included(base)
  base.option :config, desc: 'Use custom config file'
  base.option :verbose, type: :boolean, default: false, desc: 'Enable verbose output'
  base.option :path,
              type: :string,
              default: Dir.pwd,
              required: false,
              desc: 'The path containing files to be organized'
  base.option :dry_run,
              type: :boolean,
              default: false,
              required: false,
              desc: 'Perform a dry-run showing the changes that would be made'
  base.option :skip_confirm, type: :boolean, required: false, default: false, desc: 'Skip confirmation prompts'
end

Instance Method Details

#setup(config: nil, verbose: false, skip_confirm: false) ⇒ Object



22
23
24
25
26
# File 'lib/astro_subframe_organizer/commands/shared_options.rb', line 22

def setup(config: nil, verbose: false, skip_confirm: false)
  ENV['ASTRO_SUBFRAME_ORGANIZER_CONFIG'] = config
  ENV['ASTRO_SUBFRAME_SKIP_CONFIRM'] = 'true' if skip_confirm
  AstroSubframeOrganizer.logger.level = Logger::DEBUG if verbose
end