Skip to content

Commit

Permalink
Add module entry points for xq and tomlq
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Apr 17, 2024
1 parent 88d742b commit 659d2a2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ the ``xq --xml-output``/``xq -x`` option. Multiple XML documents can be passed i
``xq a.xml b.xml``. Use ``--xml-item-depth`` to descend into large documents, streaming their contents without loading
the full doc into memory (for example, stream a `Wikipedia database dump <https://dumps.wikimedia.org>`_ with
``cat enwiki-*.xml.bz2 | bunzip2 | xq . --xml-item-depth=2``). Entity expansion and DTD resolution is disabled to avoid
XML parsing vulnerabilities.
XML parsing vulnerabilities. Use ``python -m yq.xq`` if you want to ensure a specific Python runtime.

TOML support
------------
``yq`` supports `TOML <https://toml.io/>`_ as well. The ``yq`` package installs an executable, ``tomlq``, which uses the
`tomlkit library <https://github.com/sdispater/tomlkit>`_ to transcode TOML to JSON, then pipes it to ``jq``. Roundtrip
transcoding is available with the ``tomlq --toml-output``/``tomlq -t`` option.
transcoding is available with the ``tomlq --toml-output``/``tomlq -t`` option. Use ``python -m yq.tomlq`` if you want to
ensure a specific Python runtime.

.. admonition:: Compatibility note

Expand Down
Empty file added yq/tomlq/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions yq/tomlq/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .. import tq_cli

if __name__ == "__main__":
tq_cli()
Empty file added yq/xq/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions yq/xq/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .. import xq_cli

if __name__ == "__main__":
xq_cli()

0 comments on commit 659d2a2

Please sign in to comment.