Skip to content

Conversation

@baronfel
Copy link
Member

@baronfel baronfel commented Nov 1, 2022

As reported here, some string arguments set their default value to the current directory. The way this is currently configured looks up and sets this value at parser-construction time as opposed to command-invocation time, which has a few side effects that we should change:

  • this work is done for every parse, instead of deferring to just parses that invoke the Command that uses the Argument configured in this way
  • this work can potentially fail, giving unexpected errors to the user - in the linked thread @khalidabuhakmeh was running a workload command, but the stack trace came from the add command

@ghost ghost added the Area-Infrastructure label Nov 1, 2022
@baronfel baronfel added Area-CLI cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on) and removed Area-Infrastructure labels Nov 1, 2022
@baronfel baronfel added this to the 7.0.2xx milestone Nov 1, 2022
@KalleOlaviNiemitalo
Copy link
Contributor

Does System.CommandLine provide a way to avoid even constructing the Argument instances of subcommands other than the subcommand chosen by the user?

@baronfel baronfel requested a review from dsplaisted December 19, 2022 16:38
@marcpopMSFT marcpopMSFT changed the base branch from release/7.0.2xx to release/7.0.3xx January 18, 2023 22:19
@marcpopMSFT marcpopMSFT merged commit de281d1 into dotnet:release/7.0.3xx Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-CLI cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants