18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/switch_file/app.rb', line 18
def execute
source = Source.new(:path => options['path'])
begin
shortcut = options['shortcut'] || ask(source.prompt_message)
unless shortcut.strip.empty?
target_command = source.project.file_type_with_shortcut!(shortcut).generate_open_command(source)
`#{target_command}`
end
rescue Project::NoMatchingFileTypeForShortcut => exception
if SwitchFile.production?
say exception.message
retry
end
end
rescue SwitchFile::Exception => exception
say exception.message if SwitchFile.production?
end
|