-
Notifications
You must be signed in to change notification settings - Fork 13
Description
The hugr-cli crate is a installable binary for manipulating and verifying HUGR programs from the command line.
See package documentation here: https://docs.rs/hugr-cli/latest/hugr_cli/
The source code can be found under the /hugr-cli/ subdirectory.
The binary currently provides two commands,
hugr validatewill validate a.hugrfile and report any errors.hugr mermaidwill render the HUGR as a mermaid graph.
We want to extend the functionality via external tool in a similar manner to how cargo does it,
If a custom tool foo is available in the user's PATH as hugr-foo, calling hugr foo will call it directly and forwards arguments to it.
The crate uses clap for handling arguments. Some hooks for external commands have been defined already. See:
-
Cli arguments definition, including an
external_subcommandvariant: https://github.com/CQCL/hugr/blob/b162a4fe4135e25055d9393da5497c74a997d21d/hugr-cli/src/lib.rs#L85-L86 -
Cli argument handling, currently
panics: https://github.com/CQCL/hugr/blob/b162a4fe4135e25055d9393da5497c74a997d21d/hugr-cli/src/main.rs#L14-L19 -
Clap's documentation about external subcommands: https://docs.rs/clap/latest/clap/struct.Command.html#method.allow_external_subcommands
Note the remark about needing to check for subcommand existence and giving an appropriate error if necessary. -
Our development guide for setting up your environment: DEVELOPMENT.md
What we expect from a PR:
- Support for calling external tools from a user's PATH.
- Some simple tests for error handling (see
/hugr-cli/tests/) - Green CI checks for formatting, clippy lints, and tests.
Bonus points:
- Add an integration test with a dummy tool.