Class: SwitchFile::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/switch_file/app.rb

Instance Method Summary collapse

Instance Method Details

#execute(source_path) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/switch_file/app.rb', line 15

def execute(source_path)
  SwitchFile.config_path = options['config']
  sp = SourcePath.new(value: source_path)
  shortcut = FileTypeShortcut.new(value: options['shortcut'] ||  ask(sp.prompt_message))
  target_command = shortcut.file_type.generate_open_command(sp)
  `#{target_command}`
end