Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure Argument Clinic CLI #107467

Closed
3 tasks done
Tracked by #104683
erlend-aasland opened this issue Jul 30, 2023 · 2 comments
Closed
3 tasks done
Tracked by #104683

Restructure Argument Clinic CLI #107467

erlend-aasland opened this issue Jul 30, 2023 · 2 comments
Labels
topic-argument-clinic type-feature A feature request or enhancement

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Jul 30, 2023

Suggesting to ...:

  • make the clinic tool a well-behaved command-line citizen; write to stderr, not stdout, on error (partly depends on Rework Argument Clinic error handling #107468)
  • put the whole CLI in main, making it easier to mock the tool in the test suite (currently we use subprocesses, which is slow, and requires several lines of boiler-plate test setup code)
  • Introduce CLIError and use it for usage errors Used ArgumentParser.error instead.

Linked PRs

@erlend-aasland erlend-aasland added type-feature A feature request or enhancement topic-argument-clinic labels Jul 30, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 30, 2023
- Add and use CLIError exception for CLI usage errors
- On CLI error, print to stderr instead of stdout
- Put the entire CLI in main()
- Rework ClinicExternalTest to call main() instead of using subprocesses
erlend-aasland added a commit that referenced this issue Aug 1, 2023
- Use ArgumentParser.error() to handle CLI errors
- Put the entire CLI in main()
- Rework ClinicExternalTest to call main() instead of using subprocesses

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
@AA-Turner
Copy link
Member

@erlend-aasland is there anything left to do in this issue? Looks like #107469 captured all of this (maybe save stderr/stdout?)

A

@erlend-aasland
Copy link
Contributor Author

Thanks for the heads-up! Yes, this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-argument-clinic type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants