Skip to content

Improvements to command line interface#16

Open
merlinz01 wants to merge 4 commits intohenadzit:mainfrom
merlinz01:cli-improvement
Open

Improvements to command line interface#16
merlinz01 wants to merge 4 commits intohenadzit:mainfrom
merlinz01:cli-improvement

Conversation

@merlinz01
Copy link
Copy Markdown
Contributor

This PR uses click instead of argparse for the command line interface.

Benefits include:

  • Ability to define global options
  • Ability to define options with env var backup
  • Builtin colorization for more attractive and readable output
  • An Abort error to exit cleanly

Copy link
Copy Markdown
Owner

@henadzit henadzit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Although I don't like the idea of adding dependencies to the project when it can be avoided. There is no need to have click, this can be achieved with argparse.

@merlinz01
Copy link
Copy Markdown
Contributor Author

IMHO it's worth the single dependency for the increase in readability/maintainability, type safety, functionality, and user experience quality.

Aerich uses asyncclick which is an async-compatible fork of click.

@merlinz01 merlinz01 changed the title Use click for command line interface Improvements to command line interface Apr 26, 2025
@merlinz01
Copy link
Copy Markdown
Contributor Author

OK, I've gotten it fairly similar without click dependency, with a few helper functions. See the updated code.

@merlinz01 merlinz01 requested a review from henadzit April 26, 2025 00:51
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.

2 participants