Skip to content

Add support for external clap subcommands in hugr-cli #1343

@ss2165

Description

@ss2165

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 validate will validate a .hugr file and report any errors.
  • hugr mermaid will 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:

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions