Specify hugr-cli extensions
Closed this issue · 3 comments
doug-q commented
@ss2165 :
Proposal:
- Adopt the cargo subcommand model for hugr cli. Move validation and visualisation to builtin sub commands. If
hugr-<subcommand>
is inPATH
hugr subcommand
works. Extension subcommands are independent binaries.- Publish
hugr-runllvm
binary fromhugr-llvm
repo (or perhapshugr-llvm
with optional--run
option, without it just outputs LLVM bitcode)- Guppy specific compilation passes can be added to
hugr build
builtin subcommand. Customisable ashugr build --passes "guppy_pre" "guppy_opt_2" "guppy_post"
, or something similar.- Guppy runner python package takes guppy module and strings together subprocess calls to
hugr
cli as appropriate. (edited)
Questions:
- Does
hugr
do anything except delegate to subcommands? - The subcommands must control which extensions are used. This means every "leaf" downstream, which is where extensions are known, needs it's own subcommand.
- Should
hugr-cli
provide helpers to parse + validate a hugr? What else?
ss2165 commented
Maybe the first two questions can answer each other? i.e. hugr
main commands only job is attach extensions to hugrs before calling subcommands?
ss2165 commented
From @zrho in duplicate issue #1311
Currently the hugr-cli binary can just validate hugrs. To allow for more tooling to be consolidated into the CLI tool, I propose we use subcommands (like cargo and git do). The current functionality can be moved to a validate subcommand, so that it would be run with hugr validate [...]. Clap has good support for this.