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

CLI is dumb #103

Open
thirtytwobits opened this issue Apr 15, 2024 · 2 comments
Open

CLI is dumb #103

thirtytwobits opened this issue Apr 15, 2024 · 2 comments

Comments

@thirtytwobits
Copy link
Member

The Yakut CLI is overly rigid and unintelligent. Example:

> yakut mon -h
Usage: yakut monitor [OPTIONS]
Try 'yakut monitor --help' for help.

Error: No such option: -h

> yakut mon --path ~/.dsdl/types

Usage: yakut monitor [OPTIONS]
Try 'yakut monitor --help' for help.

Error: No such option: --path

> yakut mon --help --path ~/.dsdl/types

Usage: yakut monitor [OPTIONS]
Try 'yakut monitor --help' for help.

Error: No such option: --path

> yakut mon --help

(no --path option shown)

> yakut mon

Error: Run `yakut compile <path>/uavcan` to compile DSDL namespace 'uavcan'

Modern CLIs are flexible and smart. click is obviously retrograde and should be disused.

@pavel-kirienko
Copy link
Member

Can you recommend alternatives to Click? If not, we could perhaps extract main command options (such as --verbose, --json, etc) into a shared decorator and use it with subcommands as well. Or maybe it would be easier to extend Click to make subcommands inherit options from its parent command.

Related: pallets/click#2189

@thirtytwobits
Copy link
Member Author

thirtytwobits commented Apr 16, 2024

Use argparse and argcomplete.
You should separate the concerns of the CLI from the library in a similar way one separates view from view-model in a GUI application.

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

No branches or pull requests

2 participants