mill-cli 0.2.4
Toolkit for your development environment

# Mill

[![Continous integration](https://github.com/tiwilliam/mill/actions/workflows/ci.yml/badge.svg)](https://github.com/tiwilliam/mill/actions/workflows/ci.yml)

Mill lets you define commands for your project. Mill was created to be a replacement for Make in Python projects, but can be used in projects of any language.

## Installation

Mill is published on PyPi, install it using `pip`:

```
pip install mill-cli
```

## Getting started

Mill commands are defined in a `Millfile`, it maps a command to pre-defined tasks. Here is an example file:

```yaml
name: mill

up:
    - python: 3.10.0
    - pip: requirements/development.txt
commands:
    test: py.test --color=yes
    style:
        - run: yapf -rip mill
        - run: flake8 .
    upload:
        - pypi: upload
```

Running a command:

```
$ mill test
=> Running command: py.test --color=yes
============================= test session starts ==============================
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /Users/joe/mill-cli
collected 5 items

tests/test_cli.py .....                                                  [100%]

============================== 5 passed in 0.27s ===============================
```

## Bundled tasks

You can list all tasks available to Mill using the `-t` flag. This will list all bundled tasks and locally provided custom tasks.

```
$ mill -t
                            Tasks
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Task                ┃ Description                          ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ docker_compose      │ Manage docker-compose                │
│ docker_compose_exec │ Run shell commands in docker-compose │
│ homebrew            │ Install formulas on macOS            │
│ homebrew_cask       │ Install cask formulas on macOS       │
│ python              │ Install a specific Python version    │
│ run                 │ Run shell commands                   │
│ pip                 │ Run pip install                      │
│ pypi                │ Manage packages on PyPi              │
└─────────────────────┴──────────────────────────────────────┘
```

## Custom tasks

Mill provides a handful of common and useful tasks by default, but you might want to define your own to simplify your `Millfile`. A new task can easily be defined in your project by placing it in a `mills` module.

1. Create `mills.custom_task` and define a class named `CustomTask` with a `run` method:

    ```python
    from mill.task import Task


    class CustomTask(Task):
        __description__ = 'Run a custom command'

        def run(self, args, extra_args):
            print('Hello world!')
    ```

1. Reference your new task in your `Millfile`:

    ```
    name: project

    up:
        - custom_task
    ```

1. Try running it:

    ```
    $ mill up
    Hello world!
    ```

## Opening URLs

Mill provide a way to open links related to your project. A new pull request or issue can easily be opened if your project is hosted on Github. Custom links are added to your `Millfile`.

```
open:
    actions: https://github.com/tiwilliam/mill/actions
```

Open links using the `mill open` command:

```
$ mill open actions
=> Running command: open https://github.com/tiwilliam/mill/actions

$ mill open pr
=> Running command: open https://github.com/tiwilliam/mill/pull/open-url
```

## License

This project is licensed under the terms of the MIT license.