Skip to content

Global option descriptions are not shown in help output #33

Description

@autocarl

Summary

Custom global options/global parameters show the generic description Custom global option. in help output, even when the underlying typed global option properties have [Description] metadata.

Reproduction

using System.ComponentModel;
using Repl;
using Repl.Parameters;

var app = ReplApp.Create().UseDefaultInteractive();
app.WithDescription("Global parameter help repro");
app.UseGlobalOptions<DemoGlobals>();

app.Map("status", (DemoGlobals globals) => new
{
    globals.Tenant,
    globals.Verbose,
}).WithDescription("Show current global options.");

return app.Run(args);

public sealed class DemoGlobals
{
    [Description("Tenant id used for all commands.")]
    [ReplOption(Aliases = ["-t"])]
    public string? Tenant { get; set; } = "default";

    [Description("Enable verbose diagnostics for all commands.")]
    [ReplOption(Aliases = ["-v"])]
    public bool Verbose { get; set; }
}

Run:

dotnet run -- --no-logo --help

Observed:

Global Options:
  --help                   Show help for current scope or command.
  --interactive            Force interactive mode.
  --no-interactive         Prevent interactive mode.
  --no-logo                Disable banner rendering.
  --output:<format>        Set output format (for example human, json, yaml, xml, markdown).
  --human                  Select standard text output.
  --answer:<name>[=value]  Provide prompt answers in non-interactive execution.
  --tenant, -t             Custom global option.
  --verbose, -v            Custom global option.

Expected:

  --tenant, -t             Tenant id used for all commands. [default: default]
  --verbose, -v            Enable verbose diagnostics for all commands.

or at least descriptions that come from the global option metadata instead of the generic fallback.

Additional observation

Command-specific help does not show global options at all:

dotnet run -- --no-logo status --help

Observed:

Usage: status
Description: Show current global options.

This may be intentional, but if global options are valid for every command, it may be worth deciding whether command help should include them or link back to root/scope help.

Source inspection notes

HelpTextBuilder.Rendering.BuildGlobalOptionRows() currently hard-codes custom global options as:

"Custom global option."

GlobalOptionDefinition currently stores:

Name,
CanonicalToken,
Aliases,
DefaultValue,
ValueType,
OwnerType

It does not store a description.

UseGlobalOptions<T>() registers typed properties through AddGlobalOptionCore(...), but does not pass through [Description] metadata from properties.

The explicit ParsingOptions.AddGlobalOption<T>(...) API also has no description parameter today.

Environment observed

  • Repl package: 0.11.0-dev.56
  • .NET SDK: 10.0.301
  • OS: Ubuntu 24.04 linux-x64

Repro artifact:

/opt/data/carl/projets/repl-toolkit/agent-demos/repl-intuition-20260624/004-global-parameters-help/

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions