File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -625,7 +625,7 @@ def normalize_command_name(meth) #:nodoc:
625
625
# alias name.
626
626
def find_command_possibilities ( meth )
627
627
len = meth . to_s . length
628
- possibilities = all_commands . merge ( map ) . keys . select { |n | meth == n [ 0 , len ] } . sort
628
+ possibilities = all_commands . reject { | k , v | v . is_a? ( HiddenCommand ) } . merge ( map ) . keys . select { |n | meth == n [ 0 , len ] } . sort
629
629
unique_possibilities = possibilities . map { |k | map [ k ] || k } . uniq
630
630
631
631
if possibilities . include? ( meth )
Original file line number Diff line number Diff line change @@ -129,6 +129,16 @@ Linebreaks preserved
129
129
true
130
130
end
131
131
132
+ desc "potentially_ambiguous" , "not really ambiguous because conflicting command is hidden"
133
+ def potentially_ambiguous
134
+ true
135
+ end
136
+
137
+ desc "potentially_ambiguous_but_hidden" , "not considered for ambiguous check because it's hidden" , hide : true
138
+ def potentially_ambiguous_but_hidden
139
+ false
140
+ end
141
+
132
142
private
133
143
134
144
def method_missing ( meth , *args )
Original file line number Diff line number Diff line change @@ -522,6 +522,10 @@ def self.exit_on_failure?
522
522
it "invokes an alias" do
523
523
expect ( MyScript . start ( %w( animal_pri ) ) ) . to eq ( MyScript . start ( %w( zoo ) ) )
524
524
end
525
+
526
+ it "invokes a command, even when there's a hidden command that makes invokation ambiguous" do
527
+ expect ( MyScript . start ( %w( potentially_ ) ) ) . to eq ( MyScript . start ( %w( potentially_ambiguous ) ) )
528
+ end
525
529
end
526
530
527
531
context "when the user enters an ambiguous substring of a command" do
You can’t perform that action at this time.
0 commit comments