Command-line usage
==================
.. click:: xettel.commands:cli
:prog: xettel
:nested: full
Subcommands
-----------
Interfacing with Xapian
~~~~~~~~~~~~~~~~~~~~~~~
.. click:: xettel.ui.database:updatedb
:prog: xettel updatedb
.. click:: xettel.ui.search:search
:prog: xettel search
In this command, the query is either ``*``, meaning the whole database, or a
valid ``xapian`` query. Much like ``notmuch``, a query is a string made of
prefixed terms or free terms joined together with logical operators ``OR``,
``AND`` and so on. Please refer to `Xapian documentation`_ for the explicit format
of the queries.
.. _Xapian Documentation: https://xapian.org/docs/queryparser.html
Following ``xettel``'s agnostic philosophy, prefixes may be anything, as they are
set in the implementations. However, there are a few conventions and some of the
prefixes are set in the base class so are always available.
``uid``
This prefix refers to the UID of a document, its value being a number in base
10 or 36. There is no need to pad it so that it fits in 8 or 12 characters
contrarily to filenames. Note however that since searching is done on strings,
you may either use a properly formatted UID or a number without leading
zeroes. This is a boolean prefix.
``text``
Searches in the text of Zettels. The prefix is optional.
``title``
Searches in the title of Zettels.
``abstract``
Searches in the abstract of Zettels.
``tag``
Searches among tags. This is a boolean prefix.
``filepath``
Searches among the file path of the Zettels.
``filename``
Searches among the file names of the Zettels.
``links``
Searches the Zettels that link to the provided uid. Conventions follow the
same rules as for the prefix ``uid``. This is a boolean prefix.
``backlinks``
Searches the Zettels that are linked from the provided uid. Conventions follow
the same rules as for the prefix ``uid``. This is a booolean prefix.
.. click:: xettel.ui.search:count
:prog: xettel count
Queries are the same as for ``xettel search``.
Editing Zettels
~~~~~~~~~~~~~~~
.. click:: xettel.ui.editor:new
:prog: xettel new
This command generates the new ID for the Zettel with the current time, as
``YYMMDDHHmmSS`` and copies the template file to ``UID-NAME.ext``, with the UID
in uppercase base 36.
.. click:: xettel.ui.editor:edit
:prog: xettel edit
``IDENTIFIER`` is a query that must match a single Zettel.
Exporting
~~~~~~~~~
.. click:: xettel.ui.export:export
:prog: xettel export
This command calls the ``export`` method of implementations. Unless ``-f`` is
specified, it does not export Zettels if the destination file is newer than the
source Zettel.
.. click:: xettel.ui.export:gentags
:prog: xettel gentags
This method calls the ``tag_export`` class method of implementations.
Graph aspects of a Zettelkasten
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. click:: xettel.ui.graph:health
:prog: xettel health
This command checks if the Zettelkasten is weakly-connected to the root, i.e.
the Zettel with uid ``0``.
.. click:: xettel.ui.graph:genmap
:prog: xettel genmap
This command generates an svg clickable map of the Zettelkasten in the export
folder. It uses ``graphviz`` in order to do so. Some special tweaking is done
for edges between two hubs in order to render the produced map more legible.
If you want for this map to be included in your Zettelkasten, create a new
Zettel showing it, for instance::
---
title: Map of the zettelkasten
tags: [meta]
---