class Rly::Commands::Open
Public Class Methods
new(name, options)
click to toggle source
# File lib/rly/commands/open.rb, line 9 def initialize(name, options) @name = name @options = options end
Public Instance Methods
execute(input: $stdin, output: $stdout)
click to toggle source
# File lib/rly/commands/open.rb, line 14 def execute(input: $stdin, output: $stdout) shortcuts = Rly::Shortcuts.new if shortcuts.exist?(@name) open(shortcuts.find(@name)) else output.puts "can't find shortcut with name #{@name}" end end
open(url)
click to toggle source
# File lib/rly/commands/open.rb, line 23 def open(url) if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ system "start #{url}" elsif RbConfig::CONFIG['host_os'] =~ /darwin/ system "open #{url}" elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/ system "xdg-open #{url}" end end