Skip to content

pshlex - API reference

Commonly-used functions

pshlex.join(values)

Join a list of path-like objects and quote the result for the shell.

Source code in src/pshlex/__init__.py
def join(values: Iterable[str | pathlib.Path]) -> str:
    """Join a list of path-like objects and quote the result for the shell."""
    return join_any(values)

Less commonly-used functions

pshlex.join_any(values)

Join a list of any stringifiable objects and quote the result for the shell.

Source code in src/pshlex/__init__.py
def join_any(values: Iterable[Any]) -> str:
    """Join a list of any stringifiable objects and quote the result for the shell."""
    return shlex.join(str(word) for word in values)

Helper constants

pshlex.FEATURES = {'pshlex': VERSION, 'join': '1.0', 'join_any': '1.0'} module-attribute

The list of features supported by the pshlex library.

pshlex.VERSION = '0.1.0' module-attribute

The pshlex library version, semver-like.