···28282929Full documentation of available Pyzotero methods, code examples, and sample output is available on [Read The Docs][3].
30303131+# Command-Line Interface
3232+3333+Pyzotero includes an optional command-line interface for searching and querying your local Zotero library. The CLI must be installed separately (see [Installation](#optional-command-line-interface)).
3434+3535+## Basic Usage
3636+3737+The CLI connects to your local Zotero installation and allows you to search your library, list collections, and view item types:
3838+3939+```bash
4040+# Search for top-level items
4141+pyzotero search -q "machine learning"
4242+4343+# Search with full-text mode
4444+pyzotero search -q "climate change" --fulltext
4545+4646+# Filter by item type
4747+pyzotero search -q "methodology" --itemtype book --itemtype journalArticle
4848+4949+# Search for top-level items within a collection
5050+pyzotero search --collection ABC123 -q "test"
5151+5252+# Output as JSON for machine processing
5353+pyzotero search -q "climate" --json
5454+5555+# List all collections
5656+pyzotero listcollections
5757+5858+# List available item types
5959+pyzotero itemtypes
6060+```
6161+6262+## Output Format
6363+6464+By default, the CLI outputs human-readable text with a subset of metadata including:
6565+- Title, authors, date, publication
6666+- Volume, issue, DOI, URL
6767+- PDF attachments (with local file paths)
6868+6969+Use the `--json` flag to output structured JSON.
7070+3171# Installation
32723373* Using [uv][11]: `uv add pyzotero`
3474* Using [pip][10]: `pip install pyzotero`
3575* Using Anaconda:`conda install conda-forge::pyzotero`
7676+7777+## Optional: Command-Line Interface
7878+7979+Pyzotero includes an optional command-line interface for searching and querying your local Zotero library.
8080+8181+### Installing the CLI
8282+8383+To install Pyzotero with the CLI:
8484+8585+* Using [uv][11]: `uv add "pyzotero[cli]"`
8686+* Using [pip][10]: `pip install "pyzotero[cli]"`
8787+8888+### Using the CLI without installing
8989+9090+If you just want to use the CLI without permanently installing Pyzotero, you can run it directly:
9191+9292+* Using [uvx][11]: `uvx --from "pyzotero[cli]" pyzotero search -q "your query"`
9393+* Using [pipx][10]: `pipx run --spec "pyzotero[cli]" pyzotero search -q "your query"`
9494+9595+See the [Command-Line Interface](#command-line-interface) section below for usage details.
9696+9797+## Installing from Source
9898+3699* From a local clone, if you wish to install Pyzotero from a specific branch:
3710038101Example:
+82
doc/index.rst
···54545555Using `Anaconda <https://www.anaconda.com/distribution/>`_: ``conda install conda-forge::pyzotero``
56565757+-------------------------------
5858+Optional: Command-Line Interface
5959+-------------------------------
6060+6161+Pyzotero includes an optional command-line interface for searching and querying your local Zotero library.
6262+6363+To install Pyzotero with the CLI:
6464+6565+* Using `uv <https://docs.astral.sh/uv/>`_: ``uv add "pyzotero[cli]"``
6666+* Using `pip <http://www.pip-installer.org/en/latest/index.html>`_: ``pip install "pyzotero[cli]"``
6767+6868+If you just want to use the CLI without permanently installing Pyzotero:
6969+7070+* Using `uvx <https://docs.astral.sh/uv/>`_: ``uvx --from "pyzotero[cli]" pyzotero search -q "your query"``
7171+* Using `pipx <https://pipx.pypa.io/>`_: ``pipx run --spec "pyzotero[cli]" pyzotero search -q "your query"``
7272+7373+See :ref:`cli-usage` for usage details.
7474+5775From a local clone, if you wish to install Pyzotero from a specific branch:
58765977 .. code-block:: bash
···8098Testing requires installation of the ``dev`` dependency group (see above).
819982100Run ``pytest .`` from the top-level directory.
101101+102102+.. _cli-usage:
103103+104104+==========================
105105+Command-Line Interface Usage
106106+==========================
107107+108108+The Pyzotero CLI connects to your local Zotero installation and allows you to search your library, list collections, and view item types.
109109+110110+Basic Commands
111111+--------------
112112+113113+Search for top-level items:
114114+115115+ .. code-block:: bash
116116+117117+ pyzotero search -q "machine learning"
118118+119119+Search with full-text mode:
120120+121121+ .. code-block:: bash
122122+123123+ pyzotero search -q "climate change" --fulltext
124124+125125+Filter by item type:
126126+127127+ .. code-block:: bash
128128+129129+ pyzotero search -q "methodology" --itemtype book --itemtype journalArticle
130130+131131+Search for top-level items within a collection:
132132+133133+ .. code-block:: bash
134134+135135+ pyzotero search --collection ABC123 -q "test"
136136+137137+Output as JSON for machine processing:
138138+139139+ .. code-block:: bash
140140+141141+ pyzotero search -q "climate" --json
142142+143143+List all collections:
144144+145145+ .. code-block:: bash
146146+147147+ pyzotero listcollections
148148+149149+List available item types:
150150+151151+ .. code-block:: bash
152152+153153+ pyzotero itemtypes
154154+155155+Output Format
156156+-------------
157157+158158+By default, the CLI outputs human-readable text with all relevant metadata including:
159159+160160+* Title, authors, date, publication
161161+* Volume, issue, DOI, URL
162162+* PDF attachments (with local file paths)
163163+164164+Use the ``--json`` flag to output structured JSON suitable for consumption by other tools and agents.
831658416685167======================