Skip to content

Commit

Permalink
Improve and clarify matrix raw command's help
Browse files Browse the repository at this point in the history
- Use proper rst syntax for stating commands/cli/monospaced (double
  backticks), which improves rendered docs and still looks good enough
  in --help on the shell.
- Clarify which config settings we are referring to.
- Format token precedence list with \b (displays linebreaks as-is;
  renders nicely on the shell as well as in the Sphinx docs.
- Add an "insecure warning"
  • Loading branch information
JOJ0 committed Oct 13, 2023
1 parent 8d92852 commit aefbb13
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions synadm/cli/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,24 @@ def raw_request_cmd(helper, endpoint, method, data, data_file, token, prompt):
""" Execute a raw request to the Matrix API.
The endpoint argument is the part of the URL _after_ the configured base
URL and Matrix path (see `synadm config`). A simple get request would e.g
look like this: `synadm matrix raw client/versions`
URL (actually "Synapse base URL") and "Matrix API path" (see ``synadm
config``). A get request could look like this: ``synadm matrix raw
client/versions`` URL encoding must be handled at this point. Consider
enabling debug outputs via synadm's global flag ``-vv``
Use either --token or --prompt to provide a user's token and execute Matrix
commands on their behalf. Respect the privacy of others! Be responsible!
Use either ``--token`` or ``--prompt`` to provide a user's token and
execute Matrix commands on their behalf. Respect the privacy of others!
Act responsible!
\b
The precedence rules for token reading are:
1. Interactive input using --prompt; 2. Set on CLI via --token string;
3. Read from environment variable $MTOKEN; 4. Preconfigured admin token
set in synadm's config file.
1. Interactive input using ``--prompt``;
2. Set on CLI via ``--token``
3. Read from environment variable ``$MTOKEN``;
4. Preconfigured admin token set via ``synadm config``.
Caution: Passing secrets as CLI arguments or via environment variables is
not considered secure. Know what you are doing!
"""
if prompt:
token = click.prompt("Matrix token", type=str)
Expand Down

0 comments on commit aefbb13

Please sign in to comment.