Join various stringifiable objects and quote them for the shell
Project description
pshlex - join various stringifiable objects and quote them for the shell
[Home | GitLab | PyPI | Download | ReadTheDocs]
Overview
This library was written mainly to provide a function that can stringify
a list of path-like objects: the [join()][pshlex.join] function is very similar to
shlex.join(), but it will accept pathlib.Path objects
as well as strings.
The [join_any()][pshlex.join_any] function started off as an implementation detail, but
it may turn out to be useful in its own right; it is also similar to
shlex.join(), but it will convert any Python object into its string
representation.
Examples
Use the [join()][pshlex.join] function as a type-safe version when dealing with
path-like objects:
def run(cmd: list[str | pathlib.Path]) -> None:
"""Run a command."""
cmdstr: Final = pshlex.join(cmd)
...
sys.exit(f"Could not run `{cmdstr}`: {err}")
Contact
The pshlex library was written by Peter Pentchev.
It is developed in a GitLab repository.
This documentation is hosted at Ringlet with a copy at ReadTheDocs.
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
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
File details
Details for the file pshlex-0.1.0.tar.gz.
File metadata
- Download URL: pshlex-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70bf82f89f797655883d1f029d6cfd8fe976610a91555c2c536d5897f87885af
|
|
| MD5 |
14f529a9dc36c309a9b9e9b19c34b602
|
|
| BLAKE2b-256 |
70db45000e379fade41ee65840b87760cc62487530669ba0ebddc85d3be48f48
|
File details
Details for the file pshlex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pshlex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2697e784fd301d9c64b97ec65f98b67539163c9a9917227292f36bb40ff439f
|
|
| MD5 |
06743eb4c6bdd7e7ad364f409209f69e
|
|
| BLAKE2b-256 |
c758624b18c31994fca1294df97ff905d6d72522a1fef2d34a26b9fba7447951
|