Skip to content

Commit 51e7073

Browse files
committed
no need for file-based registration as long as sought exe exists
1 parent 9820baf commit 51e7073

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/System.CommandLine.Suggest/FileSuggestionRegistration.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ public Registration FindRegistration(FileInfo soughtExecutable)
4343
return null;
4444
}
4545

46+
if (soughtExecutable.Exists)
47+
{
48+
return new Registration(soughtExecutable.FullName);
49+
}
50+
4651
if (_registrationConfigurationFilePath == null
4752
|| !File.Exists(_registrationConfigurationFilePath))
4853
{
4954
return null;
5055
}
5156

52-
string completionTarget = File.ReadAllLines(_registrationConfigurationFilePath).LastOrDefault(line =>
53-
line.StartsWith(soughtExecutable.FullName, StringComparison.OrdinalIgnoreCase));
57+
var completionTarget =
58+
File.ReadAllLines(_registrationConfigurationFilePath).LastOrDefault(line =>
59+
line.StartsWith(soughtExecutable.FullName, StringComparison.OrdinalIgnoreCase));
5460

5561
if (completionTarget == null)
5662
{

0 commit comments

Comments
 (0)