yakut icon indicating copy to clipboard operation
yakut copied to clipboard

CLI is dumb

Open thirtytwobits opened this issue 1 year ago • 7 comments

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.

thirtytwobits avatar Apr 15 '24 22:04 thirtytwobits

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: https://github.com/pallets/click/discussions/2189

pavel-kirienko avatar Apr 16 '24 09:04 pavel-kirienko

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.

thirtytwobits avatar Apr 16 '24 17:04 thirtytwobits