Skip to content

Use System.CommandLine for sample and test runner argument parsing - #243

Open
jmaeagle99 wants to merge 1 commit into
mainfrom
system-command-line
Open

jmaeagle99 wants to merge 1 commit into
mainfrom
system-command-line

Conversation

@jmaeagle99

Copy link
Copy Markdown
Contributor

What was changed

Samples and the standalone test runner now parse their arguments with System.CommandLine instead of hand-rolled args switches. Command names are unchanged, so the README instructions still work.

Behavior differences:

  • --help works everywhere, and it, like argument errors, no longer needs a running server.
  • Running with no command (or an unknown one) prints help and exits 1, instead of throwing.
  • Ctrl+C is handled through System.CommandLine's cancellation token rather than each sample's own Console.CancelKeyPress handler.
  • Patching now has the --workflow / --start-workflow / --query-workflow options its README already documented.
  • ClientMtls gen-client-certs now accepts --file-prefix and the CA options, which were previously never registered.
  • WorkerVersioning command names are now case-sensitive.

Why?

  • Each sample had its own slightly different hand-written parser, with no --help and inconsistent errors. A mistyped command produced a stack trace, often after connecting to the server.
  • That kind of parsing can't reject arguments it doesn't recognize, so code and READMEs drifted apart unnoticed. Patching documented --workflow / --start-workflow options that the code silently ignored.
  • ClientMtls was already on System.CommandLine, but a 2022 beta whose API changed in the 2.0 release. This moves everything onto one consistent, current pattern.

Checklist

  1. Closes Use System.CommandLine for arg parsing #239

  2. Any docs updates needed? No

@jmaeagle99
jmaeagle99 requested review from a team as code owners October 17, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use System.CommandLine for arg parsing

1 participant