Build command lines and shell snippets using template strings
Project description
quotish is a combinator library for building command lines and shell snippets using PEP 750 template strings. Grab it from PyPI or read the documentation on ReadTheDocs.
>>> import quotish as qsh
>>> # Safely interpolate values into argument lists or shell-safe strings.
>>> msg = 'hello, world'
>>> qsh.cmd(t'echo {msg}!').argv()
['echo', 'hello, world!']
>>> qsh.cmd(t'echo {msg}!').render()
"echo 'hello, world!'"
>>> # Interpolate into shell lines instead to preserve shell syntax constructs.
>>> qsh.shell(t'echo {msg}; echo 123').render()
"echo 'hello, world'; echo 123"
>>> # Unpack sequences, build cartesian products, and compose the resulting
>>> # command lines together.
>>> host = 'host'
>>> pkgs = ['ripgrep', 'just']
>>> dnf = qsh.cmd(t'dnf install -y {pkgs:*}')
>>> inner = qsh.shell(rt"echo '- '{pkgs:^}$'\n' ; {dnf:*}")
>>> qsh.cmd(t'ssh {host} {inner}').argv()
['ssh', 'host', "echo '- 'ripgrep$'\\n' '- 'just$'\\n' ; dnf install -y ripgrep just"]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quotish-0.1.0.tar.gz
(19.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
quotish-0.1.0-py3-none-any.whl
(16.9 kB
view details)
File details
Details for the file quotish-0.1.0.tar.gz.
File metadata
- Download URL: quotish-0.1.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux Asahi Remix","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1c00d007d957771e8479f8b86f32071dc973d5fe537f86c0456005771eb4751
|
|
| MD5 |
b34a9967f5193354c88b79b15339bbc7
|
|
| BLAKE2b-256 |
eed1dfe2a5e1c6cc00ab929d4cbda4424f1cb97bc80001d72b61aca6d23f1ed1
|
File details
Details for the file quotish-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quotish-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux Asahi Remix","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6e1e2daa0145ccae5ef135bc3aefd4b6e8a30ec1b1292c7b62b5ee735879fb8
|
|
| MD5 |
4ab779aaa03895e657d4badcb34d40b6
|
|
| BLAKE2b-256 |
220c3fcc6e46e58440ae16810f51bb2d66ed8863e08e67dd583443f0b0483cf5
|