Skip to content

Commit 8813798

Browse files
committed
Refactor debug param to --go-debug and hide from CLI
Renamed the `debug` parameter to `goDebug` in `RunAsync` and `DevAsync`, add it on `CleanAsync`, marking it as `[Hidden]` to remove it from the CLI. Updated XML docs and parameter attributes for consistency. Adjusted logic to use `goDebug` for debugger launch.
1 parent 4b9a99a commit 8813798

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/go/Program.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Net.Http;
21
using System.Text;
32
using ConsoleAppFramework;
43
using Devlooped;
@@ -14,13 +13,13 @@
1413
/// Runs a file-based .NET app from a .cs entrypoint.
1514
/// </summary>
1615
/// <param name="input">Path to an existing .cs file or remote ref (owner/repo[@ref][:path]).</param>
17-
/// <param name="r2r">Publish with ReadyToRun instead of native AOT; supports more dynamic .NET features while keeping most publish optimizations. Alias: --go-r2r.</param>
18-
/// <param name="debug">Launch debugger before executing. Alias: --go-debug.</param>
16+
/// <param name="r2r">Publish with ReadyToRun instead of native AOT; supports more dynamic .NET features while keeping most publish optimizations. </param>
17+
/// <param name="goDebug">Launch debugger before executing.</param>
1918
/// <param name="extraArgs">Arguments before '--' are passed to 'dotnet publish'; arguments after '--' are forwarded to the published app. Without '--', all extra arguments are forwarded to the published app.
2019
/// </param>
21-
static async Task<int> RunAsync([Argument] string input, bool r2r = false, bool debug = false, [Argument] params string[] extraArgs)
20+
static async Task<int> RunAsync([Argument] string input, bool r2r = false, [Hidden] bool goDebug = false, [Argument] params string[] extraArgs)
2221
{
23-
if (debug)
22+
if (goDebug)
2423
System.Diagnostics.Debugger.Launch();
2524

2625
var source = await GetEffectiveSourceAsync(input);
@@ -58,8 +57,12 @@ state.App is not null &&
5857
/// </summary>
5958
/// <param name="input">Path to an existing .cs file or remote ref (owner/repo[@ref][:path]).</param>
6059
/// <param name="all">Delete cached artifacts for all apps instead.</param>
61-
static int CleanAsync([Argument] string? input = null, bool all = false)
60+
/// <param name="goDebug">Launch debugger before executing.</param>
61+
static int CleanAsync([Argument] string? input = null, [Hidden] bool all = false, [Hidden] bool goDebug = false)
6262
{
63+
if (goDebug)
64+
System.Diagnostics.Debugger.Launch();
65+
6366
if (all)
6467
{
6568
if (input is not null)
@@ -145,13 +148,13 @@ static int CleanAsync([Argument] string? input = null, bool all = false)
145148
/// Runs a file-based .NET app from a .cs entrypoint using dotnet run for fast iteration.
146149
/// </summary>
147150
/// <param name="input">Path to an existing .cs file or remote ref (owner/repo[@ref][:path]).</param>
148-
/// <param name="r2r">Accepted for consistency (ignored for dev which uses dotnet run). Alias: --go-r2r.</param>
149-
/// <param name="debug">Launch debugger before executing. Alias: --go-debug.</param>
151+
/// <param name="r2r">Accepted for consistency (ignored for dev which uses dotnet run).</param>
152+
/// <param name="goDebug">Launch debugger before executing.</param>
150153
/// <param name="extraArgs">Arguments before '--' are passed to 'dotnet run'; arguments after '--' are forwarded to the app. Without '--', all extra arguments are forwarded to the app.
151154
/// </param>
152-
static async Task<int> DevAsync([Argument] string input, bool r2r = false, bool debug = false, [Argument] params string[] extraArgs)
155+
static async Task<int> DevAsync([Argument] string input, [Hidden] bool r2r = false, [Hidden] bool goDebug = false, [Argument] params string[] extraArgs)
153156
{
154-
if (debug)
157+
if (goDebug)
155158
System.Diagnostics.Debugger.Launch();
156159

157160
var source = await GetEffectiveSourceAsync(input);

0 commit comments

Comments
 (0)