jeeves.py
While GNU Make goals are specified in a file named Makefile
, Jeeves looks for commands in a file named jeeves.py
in current directory.
Commands
Every Python function in jeeves.py
is converted into a command.
- Docstrings are used as command documentation,
- Command arguments are configured by arguments of respective functions (and their type hints!)
Let's look at a simple Hello World script.
jeeves.py
def hi(name: str):
"""Greet the user."""
print(f'Hello {name}!')
Check out how automated documentation works:
↦
j
Usage: j [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --log-level [debug|info|error] Logging level. │
│ [default: LogLevel.ERROR] │
│ --install-completion Install completion for the │
│ current shell. │
│ --show-completion Show completion for the │
│ current shell, to copy it or │
│ customize the installation. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ hi Greet the user. │
╰──────────────────────────────────────────────────────────────────────────────╯
Or, for the given command:
↦
j hi --help
Usage: j hi [OPTIONS] NAME
Greet the user.
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ * name TEXT [default: None] [required] │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
Let's run it:
↦
j hi John
Hello John!