Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mozillazg/python-shellwords
Parse line as shell words
https://github.com/mozillazg/python-shellwords
Last synced: 22 days ago
JSON representation
Parse line as shell words
- Host: GitHub
- URL: https://github.com/mozillazg/python-shellwords
- Owner: mozillazg
- License: mit
- Created: 2015-01-16T04:36:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-04T22:03:22.000Z (almost 7 years ago)
- Last Synced: 2024-10-03T15:39:55.185Z (3 months ago)
- Language: Python
- Size: 340 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
python-shellwords
==================|Build| |Coverage| |PyPI version|
Parse line as shell words.
* GitHub: https://github.com/mozillazg/python-shellwords
* License: MIT license
* PyPI: https://pypi.python.org/pypi/shellwords
* Python version: 2.6, 2.7, pypy, 3.3, 3.4Usage
-------.. code-block:: python
>>> from shellwords import ShellWords
>>> s = ShellWords()
>>> s.parse("./foo --bar=baz")
[u'./foo', u'--bar=baz']
>>> s.parse('./foo --bar=baz foobar')
[u'./foo', u'--bar=baz', u'foobar'].. code-block:: python
>>> os.environ['FOO'] = 'bar'
>>> s = ShellWords(parse_env=True)
>>> s.parse("./foo $FOO")
[u'./foo', u'bar'].. code-block:: python
>>> s = ShellWords(parse_backtick=True)
>>> s.parse("./foo `echo $SHELL`")
[u'./foo', u'/bin/bash']Thanks
-------This is based on `go-shellwords`__ package.
__ https://github.com/mattn/go-shellwords
.. |Build| image:: https://api.travis-ci.org/mozillazg/python-shellwords.png?branch=master
:target: https://travis-ci.org/mozillazg/python-shellwords
.. |Coverage| image:: https://coveralls.io/repos/mozillazg/python-shellwords/badge.png?branch=master
:target: https://coveralls.io/r/mozillazg/python-shellwords
.. |PyPI version| image:: https://pypip.in/version/shellwords/badge.png
:target: https://pypi.python.org/pypi/shellwords
.. |PyPI downloads| image:: https://pypip.in/download/shellwords/badge.png
:target: https://pypi.python.org/pypi/shellwords
.. |Python versions| image:: https://pypip.in/py_versions/shellwords/badge.svg
:target: https://pypi.python.org/pypi/shellwords