From 0eabd59f47bd491b0630844875edc482a1bb70c0 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Mon, 31 May 2021 10:11:44 +0200
Subject: [PATCH] added cli doc

---
 brian_polling_manager/cli.py | 28 ++++++++++++++++++++++++++++
 docs/source/cli.rst          |  6 ++++++
 docs/source/index.rst        | 19 +++++++++----------
 3 files changed, 43 insertions(+), 10 deletions(-)
 create mode 100644 docs/source/cli.rst

diff --git a/brian_polling_manager/cli.py b/brian_polling_manager/cli.py
index a3a1912..b2cc610 100644
--- a/brian_polling_manager/cli.py
+++ b/brian_polling_manager/cli.py
@@ -1,3 +1,28 @@
+"""
+This script queries Inventory Provider for changes
+and configures Sensu with the snmp polling checks
+required by BRIAN.
+
+.. code-block:: console
+
+    % python brian_polling_manager/cli.py --help
+    Usage: cli.py [OPTIONS]
+
+      Update BRIAN snmp checks based on Inventory Provider data.
+
+    Options:
+      --config TEXT         configuration filename
+      --force / --no-force  update even if inventory hasn't been updated
+      --help                Show this message and exit.
+
+
+The required configuration file must be
+formatted according to the following schema:
+
+.. asjson::
+    brian_polling_manager.cli.CONFIG_SCHEMA
+
+"""
 import json
 import logging
 import os
@@ -194,6 +219,9 @@ def _validate_config(ctx, param, value):
     default=False,
     help="update even if inventory hasn't been updated")
 def main(config, force):
+    """
+    Update BRIAN snmp checks based on Inventory Provider data.
+    """
 
     state = State(config['statedir'])
     last = inventory.last_update_timestamp(config['inventory'])
diff --git a/docs/source/cli.rst b/docs/source/cli.rst
new file mode 100644
index 0000000..0255ffa
--- /dev/null
+++ b/docs/source/cli.rst
@@ -0,0 +1,6 @@
+
+cli
+===================================================
+
+.. automodule:: brian_polling_manager.cli
+
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 474893b..d87a4b8 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -3,18 +3,17 @@
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-Welcome to BRIAN Polling Manager's documentation!
-=================================================
 
-.. toctree::
-   :maxdepth: 2
-   :caption: Contents:
+BRIAN Polling Manager
+======================
 
+Documentation for BRIAN Polling Manager.
+This application queries Inventory Provider and configures
+Sensu checks for polling the data required by BRIAN.
 
 
-Indices and tables
-==================
+.. toctree::
+   :maxdepth: 2
+   :caption: Contents:
 
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
+   cli
-- 
GitLab