Skip to content

Commit ce047eb

Browse files
committed
better command attribution
1 parent 7fa6f87 commit ce047eb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Cli/dotnet/Program.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ public static void Shutdown(PosixSignalContext context)
131131
s_sigIntRegistration.Dispose();
132132
s_sigQuitRegistration.Dispose();
133133
s_sigTermRegistration.Dispose();
134-
TelemetryClient?.Flush();
135134
s_mainActivity?.Stop();
136135
tracerProvider?.ForceFlush();
137136
metricsProvider?.ForceFlush();
@@ -199,6 +198,17 @@ private static void SetupMSBuildEnvironmentInvariants()
199198

200199
private static string GetCommandName(ParseResult r)
201200
{
201+
if (r.Action is Parser.PrintVersionAction)
202+
{
203+
// If the action is PrintVersionAction, we return the command name as "dotnet --version"
204+
return "dotnet --version";
205+
}
206+
else if (r.Action is Parser.PrintInfoAction)
207+
{
208+
// If the action is PrintHelpAction, we return the command name as "dotnet --help"
209+
return "dotnet --info";
210+
}
211+
202212
// walk the parent command tree to find the top-level command name and get the full command name for this parseresult
203213
List<string> parentNames = [r.CommandResult.Command.Name];
204214
var current = r.CommandResult.Parent;

0 commit comments

Comments
 (0)