Class: Speedrun::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/speedrun/cli.rb

Instance Method Summary collapse

Instance Method Details

#trim(input_file, output_file = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/speedrun/cli.rb', line 17

def trim(input_file, output_file = nil)
  unless File.exist?(input_file)
    puts "Error: File not found: #{input_file}"
    exit 1
  end

  trimmer = Trimmer.new(
    input_file,
    output_file,
    noise_threshold: options[:noise],
    min_duration: options[:duration],
    quiet: options[:quiet]
  )

  trimmer.dry_run = options[:'dry-run']
  trimmer.run
rescue => e
  puts "Error: #{e.message}"
  exit 1
end

#versionObject



8
9
10
# File 'lib/speedrun/cli.rb', line 8

def version
  puts "speedrun version #{Speedrun::VERSION}"
end