bin/u-menu in u-menu-0.8.0 vs bin/u-menu in u-menu-0.10.0
- old
+ new
@@ -41,11 +41,11 @@
options = options.sort { |a, b| a[:name] <=> b[:name] }
options.each do |option|
if option[:name].match(/\{\{(?<icon_name>.*)\}\}/)
icon_name = Regexp.last_match('icon_name')
- option[:name].sub!("{{#{icon_name}}} ", use_icons ? icons[icon_name] : '')
+ option[:name].sub!("{{#{icon_name}}}", use_icons ? icons[icon_name] : '')
else
option[:name] = "#{use_icons ? icons['terminal'] : ''} #{option[:name]}" if option[:type] == 'command'
option[:name] = "#{use_icons ? icons['link'] : ''} #{option[:name]}" if option[:type] == 'link'
end
end
@@ -60,9 +60,14 @@
system action[:execute]
when 'link'
puts "#{colors.bold('Sure... opening link')} '#{colors.cyan(action[:execute])}'"
system "open #{action[:execute]} &"
when 'edit'
+ unless config.dig(:settings, :editor)
+ warn '[error] key `settings > editor` not found into config file.'
+ exit(1)
+ end
+
puts "#{colors.bold('Sure... opening file')} '#{colors.cyan(action[:execute])}'"
system "#{config[:settings][:editor]} #{action[:execute]}"
end
exit(0)