Skip to content

Commit

Permalink
Add documentation regarding new config commands
Browse files Browse the repository at this point in the history
  • Loading branch information
tekktrik committed Apr 4, 2024
1 parent a71d9ec commit 1f255c5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 2 deletions.
37 changes: 35 additions & 2 deletions docs/commands/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ You can modify the CLI configurations settings using ``circfirm config``.

See ``circfirm config --help`` and ``circfirm config [command] --help`` for more information on commands.

For a list of settings and their explanations, see the :ref:`Configuration Settings<config-settings>` page.

You can interact with plugin settings by adding the ``--plugin <name>`` option to any of the commands below.

View Settings
-------------

Expand All @@ -27,15 +31,17 @@ You can view all the settings, a subset, or just a specific one. Subsettings ar
Edit Settings
-------------

You can edit configuration settings using ``circfirm config view``.
You can edit configuration settings using ``circfirm config edit``.

You must edit a specific setting at a time. Subsettings are accessed using period separators.
You must edit one specific setting at a time. Subsettings are accessed using period separators.

.. code-block:: shell
# Edit a configuration settings with a value
circfirm config edit output.supporting.silence true
.. _config-editor:

Edit Settings via Editor
^^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -46,6 +52,33 @@ For a more native editing experience using the built-in text editor, you can use
# Edit the configuration settings in the native text editor
circfirm config editor
Add/Remove from List
--------------------

You can add or remove a string value to a list using ``circfirm config add`` and ``circfirm config remove``
respectively.

.. code-block:: shell
# Add the circfirm_hello_world plugin to the plugins.downloaded setting
circfirm config add plugin.downloaded circfirm_hello_world
# Remove the circfirm_hello_world plugin from the plugins.downloaded setting
circfirm config remove plugin.downloaded circfirm_hello_world
Get Configuration Filepath
--------------------------

You can see where a configruation file is located using ``circfirm config path``.

.. code-block:: shell
# See where the configuration file for circfirm is located
circfirm config path
# See where the configuration file for the circfirm_hello_world plugin is located
circfirm config path --plugin circfirm_hello_world
Reset Settings
--------------

Expand Down
50 changes: 50 additions & 0 deletions docs/configuration/settings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
..
SPDX-FileCopyrightText: 2024 Alec Delaney, for Adafruit Industries
SPDX-License-Identifier: MIT
.. _config-settings:

Configuration Settings
======================

Settings can be configured using the ``config`` command. Each setting is ASCII text, with
sub-settings accessed using periods (e.g., ``category.setting.subsetting``). To see the full
settings file, you can use ``circfirm config view``.

Below is a more in-depth reference for each of the settings:

Tokens (``token``)
------------------

GitHub Token (``token.github``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you'd like to add a GitHub token to enable authenticated requests when using the ``query``
command, you can add a GitHub token here. You can read `GitHub's documentation on tokens
<https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens>`_
for more information on how tokens work and how to create them.

Output Modification (``output``)
--------------------------------

You can optionally silence relevant supporting and warning text responses by setting ``silence``
to ``true`` each of the respective configuration settings (``output.supporting.silence`` and
``output.warning.silence``). This may be useful when writing bash scripts that will parse
responses output by ``circfirm``.

Editor (``editor``)
-------------------

You can change the in-terminal editor used by ``circfirm config editor`` (:ref:`reference<config-editor>`) by setting this to
the path of an alternative editor.

Plugins (``plugins``)
---------------------

Downloaded plugins (``plugins.downloaded``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you have downloaded plguins (i.e., from PyPI), you can activate and use them by adding their
respective import names here. This is likely to be their name with dashes replaced by underscores,
but you should check the plugin's documentation to see what value should be used. This is
especially true if the donwloaded plugin library provides multiple plugins.
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
:caption: Configuration
:hidden:

configuration/settings

.. toctree::
:maxdepth: 2
:caption: Plugins
Expand Down

0 comments on commit 1f255c5

Please sign in to comment.