Skip to content

shlex.join's docstring isn't sufficiently clear #142895

@BenFrantzDale

Description

@BenFrantzDale

Documentation

I had been using " ".join(shlex.escape(x) for x in args), not realizing that shlex.join(args) is exactly that.

The docstring is just """Return a shell-escaped string from *split_command*.""". I'd like to see something like

    """
    Return a shell-escaped string from *split_command*.
    That is, given a list of strings, return a string that, when printed,
    can be copy-pasted into a shell and provide an argc of len(split_command).
    
    For example:
    >>> print(shlex.join(['echo', 'foo \"bar\" baz']))
    echo 'foo "bar" baz'
    >>>
    $ echo 'foo "bar" baz'
    foo "bar" baz
    $
    """

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirpendingThe issue will be closed if no feedback is provided

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions