Synadm CLI Package¶
The synadm.cli
package contains all the command line frontend code
(using the Python Click module), see the sections for each subcommand for help
on usage and have a look into the files inside the synadm/cli directory to see
how the CLI frontend is constructed. The main command is defined in
__init__.py
and each subcommand lives in its own module (e.g
user.py
, room.py
, …)
Click command definition code is not very well suited for autogenerated Python
package documentations (in this case using Sphinx autodoc) but one thing in this
package that is worth mentioning and generating documentation for, is the
synadm.cli.APIHelper
class which is the connection between the CLI code and the
backend code in synadm.api
:
CLI base functions and settings
-
class
synadm.cli.
APIHelper
(config_path, verbose, batch, output_format_cli)¶ Bases:
object
API client enriched with CLI-level functions, used as a proxy to the client object.
-
FORMATTERS
= {'human': <function humanize>, 'json': <function dumps>, 'pprint': <function pformat>, 'yaml': <function dump>}¶
-
CONFIG
= {'admin_path': '/_synapse/admin', 'base_url': 'http://localhost:8008', 'matrix_path': '/_matrix', 'timeout': 7, 'token': '', 'user': ''}¶
-
init_logger
(verbose)¶ Log both to console (defaults to WARNING) and file (DEBUG).
-
_set_formatter
(_output_format)¶
-
load
()¶ Load the configuration and initialize the client.
-
write_config
(config)¶ Write a new version of the configuration to file.
-
output
(data)¶ Output data object using the configured formatter.
-