# Quickstart

This example demonstrates how to write a task file and run it with `yatte`.

After installing the package, create a file named `tasks.py` containing some functions decorated with `@task`:

    from subprocess import run
    from sys import exit, stderr

    from yatte import task

    @task("greet")
    def hello():
        """Greet the world"""
        print("Hello, world!")

    @task("list-files")
    def list_files(dir):
        """List the files in the directory"""
        shell(f"ls {dir}")

    def shell(cmd):
        print("sh>", cmd, file=stderr)
        p = run(cmd, shell=True)
        if p.returncode:
            exit(p.returncode)

Then call `yatte` by itself to list the tasks:

    $ yatte
    greet                   Greet the world
    list-files dir          List the files in the directory

And `yatte {task}` to execute the given task:

    $ yatte list-files .
    sh> ls .
    pyproject.toml README.md tasks.py

The manual describes how to use the `yatte` command in more detail.