Closed
Description
In certain circumstances Fire will execute python code albeit the command line is not valid. Consider the following MWE:
#!/usr/bin/env python
import fire
def yet_another_function(*, argument: bool = False) -> None:
print(f"Executing yet_another_function() with argument={argument}.")
if __name__ == "__main__":
fire.Fire({"yaf": yet_another_function})
If I execute it with
./mwe.py yaf yet-another-argument
I get
Executing yet_another_function() with argument=False.
ERROR: Could not consume arg: yet-another-argument
Usage: mwe.py yaf
For detailed information on this command, run:
mwe.py yaf --help
Note that the function is executed anyways.
In my case this behaviour let a bug manifest in a CI pipeline. I would have preferred to see the step break directly.
Metadata
Metadata
Assignees
Labels
No labels