Skip to content

Commit 1220d84

Browse files
committed
fix evaluation order when detecting cmd_name
Apparently the '=' operator binds stronger than the 'or' operator: $ irb irb(main):001:0> array = [] => [] irb(main):002:0> cmd_name = array.shift or "status" => "status" irb(main):003:0> cmd_name.inspect => "nil" irb(main):004:0> cmd_name = (array.shift or "status") => "status" irb(main):005:0> cmd_name.inspect => "\"status\"" Put a pair of braces around it to fix the order.
1 parent c830a89 commit 1220d84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/nom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ aliases = {
2626

2727
nom = Nom::Nom.new
2828

29-
cmd_name = ARGV.shift or "status"
29+
cmd_name = (ARGV.shift or "status")
3030

3131
if aliases.include? cmd_name.to_sym
3232
cmd_name = aliases[cmd_name.to_sym]

0 commit comments

Comments
 (0)