Skip to content

Commit 8b42f8f

Browse files
committed
improved discovery
1 parent ea85453 commit 8b42f8f

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/FlubuCore.Tests/FlubuCore.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<ProjectReference Include="..\FlubuCore\FlubuCore.csproj" />
8282
</ItemGroup>
8383
<ItemGroup>
84-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
84+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
8585
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
8686
<PrivateAssets>All</PrivateAssets>
8787
</PackageReference>

src/FlubuCore/Commanding/CommandExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public virtual async Task<int> ExecuteAsync()
5151
{
5252
script = await _scriptProvider.GetBuildScriptAsync(Args);
5353
}
54-
catch
54+
catch (Exception)
5555
{
5656
// Continue without script — completions will only include built-in options
5757
}

src/FlubuCore/Commanding/ShellCompletionProvider.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,14 @@ public IReadOnlyList<string> GetCompletions(
8686
var tokens = TokenizeCommandLine(partialCommandLine);
8787
var wordToComplete = GetWordToComplete(partialCommandLine, tokens);
8888

89-
var targetNames = DiscoverTargets(flubuSession, script, targetCreator);
90-
var scriptArgs = DiscoverScriptArgs(script, scriptProperties);
91-
9289
if (wordToComplete.StartsWith("-"))
9390
{
91+
var scriptArgs = DiscoverScriptArgs(script, scriptProperties);
9492
var candidates = BuiltInOptions.Concat(scriptArgs).ToList();
9593
return FilterCandidates(candidates, wordToComplete);
9694
}
9795

96+
var targetNames = DiscoverTargets(flubuSession, script, targetCreator);
9897
var targetCandidates = targetNames.Concat(BuiltInCommands).ToList();
9998
return FilterCandidates(targetCandidates, wordToComplete);
10099
}
@@ -122,7 +121,7 @@ private static List<string> DiscoverTargets(
122121

123122
return flubuSession.TargetTree.GetTargetNames().ToList();
124123
}
125-
catch
124+
catch (Exception)
126125
{
127126
return new List<string>();
128127
}
@@ -143,7 +142,7 @@ private static List<string> DiscoverScriptArgs(
143142
.Select(h => h.Name)
144143
.ToList();
145144
}
146-
catch
145+
catch (Exception)
147146
{
148147
return new List<string>();
149148
}

0 commit comments

Comments
 (0)