hdl / containers

Building and deploying container images for open source electronic design automation (EDA)
https://hdl.github.io/containers/
Apache License 2.0
106 stars 24 forks source link

Common arguments/options in ArgParse/pyAttributes #24

Open umarcor opened 3 years ago

umarcor commented 3 years ago

Options/arguments for the CLI in pyHDLC are declared using pyAttributes. Option -n|--noexec is defined for Run as it is expected to be available for all (sub)commands. However, it does not work if placed after them. That is, the following does work:

# ./pyHDLC/cli.py -n build sim
· docker build --progress=plain --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg REGISTRY=ghcr.io/hdl/debian-buster -t ghcr.io/hdl/debian-buster/sim -f debian-buster/sim.dockerfile .

but the following fails:

# ./pyHDLC/cli.py build -n sim
usage: cli.py [-n] [-p] [-d] {help,build,push,pull} ...
cli.py: error: unrecognized arguments: -n

It would be desirable if -n was inherited by build and both orders were accepted.

Paebbels commented 3 years ago

Similar to how GHDL behaves, that's the behavior of Pythons ArgParse.
pyAttributes is a wrapper for ArgParse, so the behavior is inherited.

Anyhow, the described behavior would be nice.