We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 146a28a commit 6532de4Copy full SHA for 6532de4
bin/oswitch
@@ -47,6 +47,13 @@ if options[:list]
47
exit
48
end
49
50
-package = ARGV[0]
51
-command = ARGV[1..-1]
52
-OSwitch.to(package, command)
+pattern = ARGV[0].strip
+command = ARGV[1..-1].join(' ')
+matches = OSwitch.packages.grep(/#{pattern}/)
53
+
54
+if matches.length > 1
55
+ puts "Which one of the following did you mean?"
56
+ puts matches.join(', ')
57
+else
58
+ OSwitch.to(matches.first || pattern, command)
59
+end
lib/oswitch.rb
@@ -40,8 +40,8 @@ def packages
40
41
42
def initialize(package, command = [])
43
- @package = package.strip
44
- @command = command.join(' ')
+ @package = package
+ @command = command
45
@imgname = "oswitch_#{@package}"
46
@cntname = "#{@package.gsub(%r{/|:}, '_')}-#{Process.pid}"
exec
0 commit comments