dotnet / dotnet/command-line-api

Usage root command does not display `ToolCommandName`

Open
#2,365 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Using version 2.0.0-beta4.24126.1

The default help display does not reflect the tool name when installed as a .NET tool.

Related to https://github.com/dotnet/command-line-api/issues/403 and https://github.com/dotnet/command-line-api/issues/682, but there is no possibility to workaround this as the `Name` property now has no setter.

Ideally it would show either the project name or the .NET tool name, depending on how it is invoked.

Currently, it appears to use `Environment.GetCommandLineArgs()[0]` to get the command name.
However, when executed as a .NET tool this seems to resolve to the underlying DLL (assuming the .NET tool exe is just a wrapper) and does not include the name of the tool.

Example:
bar.exe
installed as foo .NET tool

dir %USERPROFILE%\.dotnet\tools\
foo.exe

Invoking through .NET tool
C:\foo
args
Environment.GetCommandLineArgs() C:\Users\\.dotnet\tools\.store\\bar.dll

Usage:
bar ...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.