Skip to content

Commit

Permalink
Merge pull request #96 from wayneyaoo/fix-issue-70
Browse files Browse the repository at this point in the history
Hidden command should not get suggested when command not found.
  • Loading branch information
mayuki authored Mar 24, 2023
2 parents edbe674 + ff277ef commit 5231a2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Cocona.Core/Command/CoconaBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public async ValueTask<int> RunAsync(CancellationToken cancellationToken)
_console.Error.WriteLine(string.Format(Strings.Dispatcher_Error_NotACommand, cmdNotFoundEx.Command));
}

var similarCommands = cmdNotFoundEx.ImplementedCommands.All.Where(x => Levenshtein.GetDistance(cmdNotFoundEx.Command.ToLowerInvariant(), x.Name.ToLowerInvariant()) < 3).ToArray();
var similarCommands = cmdNotFoundEx.ImplementedCommands.All
.Where(x => !x.IsHidden && Levenshtein.GetDistance(cmdNotFoundEx.Command.ToLowerInvariant(), x.Name.ToLowerInvariant()) < 3).ToArray();
if (similarCommands.Any())
{
_console.Error.WriteLine();
Expand Down

0 comments on commit 5231a2c

Please sign in to comment.