Class: Ocak::Commands::Clean

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/ocak/commands/clean.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ocak/commands/clean.rb', line 16

def call(**options)
  config = Config.load
  do_worktrees = !options[:logs] || options[:all]
  do_logs = options[:logs] || options[:all]

  clean_worktrees(config) if do_worktrees
  clean_logs(config, keep_days: options[:keep]) if do_logs
rescue Config::ConfigNotFound => e
  warn "Error: #{e.message}"
  exit 1
end