Skip to main content
Use these snippets as starting points. Copy, adjust, and ship.

Installer-style command

from runegraft import CLI, opt

cli = CLI("installr")

@cli.command("install <url:url>")
def install(
    url: str,
    force: bool = opt("--force", "-f", default=False, help="Overwrite existing installs"),
    target: str = opt("--target", "-t", default="~/.installr", help="Install directory"),
):
    print(f"Installing {url} into {target} (force={force})")
  • The <url:url> converter validates the input before running.
  • --force + --target make the command discoverable via generated help.

Git-style subcommands

@cli.command("task add <name:str>")
def task_add(name: str):
    print(f"Added task '{name}'")

@cli.command("task list")
def task_list():
    print("Listing tasks...")
Route prefixes (task add, task list) keep related commands grouped in the shell and in help output.

Script repeatable workflows

Drop frequently used commands into a .rg file and run it with source inside the shell:
# team-setup.rg
install https://example.com/pkg.zip -f
alias set deploy-prod "deploy production --region us-east-1"
history save
In the shell:
runegraft> source ./team-setup.rg
Everyone on your team can share the same scripts to bootstrap their environment in one command.