A CLI tool for quick tasks.
Project description
Quickie - A CLI tool for quick tasks
Getting Started
Installing
Quickie can be installed either on a per-project basis and globally.
For projects it is recommended to use a virtual environment and install via pip
:
python -m venv .venv
source .venv/bin/activate
pip install quickie-runner
qck --help
For global installation, you can install quickie-runner-global
instead. It will add
quickie-runner
as a dependency, but also add a qckg
executable, which will run global
tasks by default. This allows us to run our global tasks from any project without conflicts.
For global installation it is recommended to use pipx
, as it will install it in an isolated
environment:
pipx install quickie-runner-global
qckg --help
If you have any issues with the quickie
package missing when running qckg
, you can inject it manually:
pipx inject quickie-runner-global quickie-runner
See the pipx
Tab completion
Tab completion is available for bash and zsh. It depends on the argcomplete
package, which should have been installed with quickie
.
To enable tab completion for quickie
, add the following line to your .bashrc
or .zshrc
:
eval "$(register-python-argcomplete qck)"
eval "$(register-python-argcomplete qckg)"
If you get the following error in the zsh shell:
complete:13: command not found: compdef
You can fix it by adding the following line to your .zshrc
(before the line that registers the completion):
autoload -Uz compinit && compinit
Usage
Per-project tasks are configured under a __quickie.py
or __quickie
python module in the current directory.
If using a __quickie
directory, the tasks should be defined in the __quickie/__init__.py
file.
Global tasks on the other hand should be defined in the Quickie
module in the user's directory.
Tasks are defined as classes, though factory functions are also supported.
Why define tasks in Python?
While many existing similar tools use YAML, TOML or custom formats to define tasks, quickie
uses Python for the following reasons:
- Built-in syntax highlighting and linting
- Supported by most editors and IDEs
- Easy to use and understand
- Extensible and powerful
Quick Example
Here is a simple example of a __quickie.py
file:
from quickie import arg, script, task
@task(name=["hello", "greet"])
@arg("name", help="The name to greet")
def hello(name):
"""Greet someone""" # added as the task help
print(f"Hello, {name}!")
@script(extra_args=True)
def echo():
return " ".join(["echo", *args])
You can run the hello
task with the following command:
$ qck hello world
Hello, world!
$ qck greet world
Hello, world!
And the script
task with:
$ qck echo Hello there
Hello there
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file quickie_runner-0.3.2.tar.gz
.
File metadata
- Download URL: quickie_runner-0.3.2.tar.gz
- Upload date:
- Size: 42.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbaa29385b7e135717c49ea194eff6ee6d7398c40893606a4254ec06a7c044d1 |
|
MD5 | bbc5f0cfe247a396807f20becea15861 |
|
BLAKE2b-256 | 1b8f9b63173757e8675de50ee60f4002b60d4ce96fd6fa3c15d812d3587ad478 |
File details
Details for the file quickie_runner-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: quickie_runner-0.3.2-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f988cf2b82f47bd18e4f197e739266d8eda4ea1d7bff705c5271111ace1c3bb4 |
|
MD5 | 4e2d3d25d210e4bc1f50368766cbb5b7 |
|
BLAKE2b-256 | 585efa3ce40dbe20442b682c4c8c1eb970e541dac33a32acbdce151f5b9a96f7 |