plz-cmd
A shell command to execute standard/repeatable commands in a git repo
Installation
Install plz at the system level so that it only has to be installed once.
pip install plz-cmd
# sudo may be required on your machine
sudo pip install plz-cmd
It can also be installed inside a virtualenv. However, this means you'll have to install plz-cmd for each each virtualenv in use.
virtualenv venv
. venv/bin/activate
pip install plz-cmd
Example
plz looks for a plz.yaml file either in the current directory or in the root
of the git repo you're currently in. This file can (and should) be checked into
version control.
For a plz.yaml file located in the git root directory, commands run will be executed relative to that directory, not the current directory.
Suppose we have the following plz.yaml file:
commands:
# String command
run: ./manage.py runserver
# Array of command
test:
- ./manage.py test
- yarn test
# Object command, which supports string and array `cmd`
setup:
description: Set up the development environment
cmd:
- poetry install
- poetry run ./manage.py migrate
- yarn install
# ls example is referenced further down in this README
ls: ls
The following commands would be available:
plz run
plz test
plz setup
plz ls
Getting help
List all the available commands with:
plz
# or
plz help
Print the yaml schema for any defined command with plz help <command>:
> plz help test
[INFO] Using config: plz.yaml
test:
cmd:
- poetry run python -m pytest
Description
Setting a description attribute for a command will display the description in the console output. This can be useful if the command is not self explanatory.
commands:
echo:
cmd: echo hello
description: This is a sample description
> plz echo
[INFO] Using config: plz.yaml
Description: This is a sample description
===============================================================================
Running command: echo hello
===============================================================================
hello
Environment variables
Environment variables can be set for an individual command or globally for all commands.
# env variable for an individual command
commands:
test:
cmd: ./manage.py test
env:
DJANGO_SETTINGS_MODULE: myapp.settings.test
global_env:
DJANGO_SETTINGS_MODULE: myapp.settings.test
commands:
test: ./manage.py test
Shortcuts
Similar to environment variables, shortcuts can be created witin the plz.yaml file for reference by individual commands.
shortcuts:
dc: docker-compose
commands:
start:
cmd: ${dc} up
shell:
cmd: ${dc} run web bash
Globbing
plz supports asterisk expansion. For example, the cmd ls *.py will work as expected.
Runtime arguments
plz supports passing custom arguments when running the plz command. For example:
# bind to port 8001 instead of the default 8000
plz run 127.0.0.1:8001
Any passed arguments will be tested to see if they are file paths relative to the current directory when running the command. Using this repo as an example:
bash$ ls .*.yaml
plz.yaml .pre-commit-config.yaml
bash$ cd plz
bash$ plz ls ../.*.yaml
[INFO] Using config: /path/plz/plz.yaml
===============================================================================
Running command: ls
===============================================================================
plz.yaml
.pre-commit-config.yaml
[INFO] Process complete, return code: 0
bash$ plz ls __*.py
[INFO] Using config: /path/plz/plz.yaml
===============================================================================
Running command: ls
===============================================================================
plz/__init__.py
[INFO] Process complete, return code: 0
Development
Setting up for development is easy when plz is already installed!
git clone https://github.com/m3brown/plz
cd plz
plz setup
plz test
Metadata
Release files for plz-cmd 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plz_cmd-1.2.2.tar.gz | 9.8 kB | Without provenance | Details for plz_cmd-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plz_cmd-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for plz_cmd-1.2.2-py3-none-any.whl |
Total release size: 19.7 kB
Release files / plz_cmd-1.2.2.tar.gz
| Download URL | plz_cmd-1.2.2.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca823b1edb14aa20077c7c91d0317a7e7355c4e9283ce29dfd7ffdfd7310ed2b
|
|
BLAKE2b-256 checksum How to use checksums |
20d7220fd32d2a42392e9602b90e53a8e386e6429d51fb68aaa75a84c71450f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.0 Linux/5.15.0-1022-azure
|
Release files / plz_cmd-1.2.2-py3-none-any.whl
| Download URL | plz_cmd-1.2.2-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
305314d861e2780fa489da857d4a24f55dfafa0d5a99284ace6a7ce1614fffe8
|
|
BLAKE2b-256 checksum How to use checksums |
4246897979a934b2569cf42cddd66ea4d38d48d44c3461b981473bc901db5632
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.0 Linux/5.15.0-1022-azure
|
Security for plz-cmd 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.