-
This could be useful if typer-cli supported using it in shebang: This would require Of course utils would need to be available in a different manner than now. For instance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The shebang would be useful if you make the script executable and you want to call it directly. But in that case, you could use plain Python, and run typer at the end, e.g.:
#! /usr/bin/env python
import typer
def main(name: str):
print(f"Hello {name}")
if __name__ == "__main__":
typer.run(main) And then: $ chmod +x main.py And then you can use it as a script directly: $ ./main.py Grzegorz
Hello Grzegorz Note: Typer-CLI is now part of Typer, you should simply install |
Beta Was this translation helpful? Give feedback.
typer something.py run
is needed to be able to get autocompletion in the shell and all that stuff, which is pretty much the benefit of thetyper
command.The shebang would be useful if you make the script executable and you want to call it directly. But in that case, you could use plain Python, and run typer at the end, e.g.:
main.py
:And then:
$ chmod +x main.py
And then you can use it as a script directly:
Note: Typer-CLI is now part of Typer, you should simply install
pip install typer
and you would get thetyper
…