Skip to content

Commit 44e6f97

Browse files
committed
Improve no-args help output
1 parent 423f9db commit 44e6f97

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/ProfileTool/Program.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ void PrintSection(string text)
1616
Console.WriteLine(text);
1717
}
1818

19+
void PrintUsageExamples()
20+
{
21+
Console.WriteLine("Examples:");
22+
Console.WriteLine();
23+
Console.WriteLine("CPU profiling:");
24+
Console.WriteLine(" asynkron-profiler --cpu -- dotnet run MyProject.sln");
25+
Console.WriteLine(" asynkron-profiler --cpu --calltree-depth 5 -- dotnet run MyProject.sln");
26+
Console.WriteLine(" asynkron-profiler --cpu --input ./profile-output/app.speedscope.json");
27+
Console.WriteLine();
28+
Console.WriteLine("Memory profiling:");
29+
Console.WriteLine(" asynkron-profiler --memory -- dotnet test");
30+
Console.WriteLine(" asynkron-profiler --memory --input ./profile-output/app.nettrace");
31+
Console.WriteLine();
32+
Console.WriteLine("Heap snapshot:");
33+
Console.WriteLine(" asynkron-profiler --heap -- dotnet run MyProject.sln");
34+
Console.WriteLine(" asynkron-profiler --heap --input ./profile-output/app.gcdump");
35+
Console.WriteLine();
36+
Console.WriteLine("General:");
37+
Console.WriteLine(" asynkron-profiler --help");
38+
}
39+
1940
(bool Success, string StdOut, string StdErr) RunProcess(
2041
string fileName,
2142
IEnumerable<string> args,
@@ -1680,7 +1701,7 @@ string BuildCommandDescription(string[] command)
16801701
"Command to profile (pass after --)");
16811702
commandArg.Arity = ArgumentArity.ZeroOrMore;
16821703

1683-
var rootCommand = new RootCommand("Asynkron Profiler - CPU/Memory profiling for .NET commands")
1704+
var rootCommand = new RootCommand("Asynkron Profiler - CPU/Memory/Heap profiling for .NET commands")
16841705
{
16851706
cpuOption,
16861707
memoryOption,
@@ -1736,7 +1757,7 @@ string BuildCommandDescription(string[] command)
17361757
if (command.Length == 0)
17371758
{
17381759
AnsiConsole.MarkupLine("[red]No command provided.[/]");
1739-
AnsiConsole.MarkupLine("[dim]Example: asynkron-profiler --cpu -- dotnet run MyProject.sln[/]");
1760+
PrintUsageExamples();
17401761
return;
17411762
}
17421763

0 commit comments

Comments
 (0)