Improve help in cli

This commit is contained in:
sfigato 2019-02-17 19:20:08 +01:00 committed by blallo
parent eaaf492293
commit 83f74ce799
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -157,7 +157,7 @@ def start_daemon_command(
@click.pass_context @click.pass_context
def list_command(ctx: click.Context, status: bool) -> None: def list_command(ctx: click.Context, status: bool) -> None:
""" """
Shows the clients attached Lists the clients attached
""" """
logger.debug('Invoked the "list" command.') logger.debug('Invoked the "list" command.')
with PLifo(ctx.obj["lifo"]) as lifo: with PLifo(ctx.obj["lifo"]) as lifo:
@ -181,7 +181,7 @@ def list_command(ctx: click.Context, status: bool) -> None:
@click.pass_context @click.pass_context
def start_command(ctx: click.Context, name: str) -> None: def start_command(ctx: click.Context, name: str) -> None:
""" """
Writes on the fifo. Invokes the start of a client. Starts a client.
""" """
logger.debug("Sending the start command down the pipe: %s", ctx.obj["fifo"]) logger.debug("Sending the start command down the pipe: %s", ctx.obj["fifo"])
with open(ctx.obj["fifo"], "w") as fifo: with open(ctx.obj["fifo"], "w") as fifo:
@ -193,8 +193,7 @@ def start_command(ctx: click.Context, name: str) -> None:
@click.pass_context @click.pass_context
def stop_daemon_command(ctx: click.Context) -> None: def stop_daemon_command(ctx: click.Context) -> None:
""" """
Writes on the fifo. Invokes the stop of all the clients and the Stops all the clients and shuts down the daemon.
subsequent shutdown of the daemon.
""" """
logger.debug("Sending the stop-daemon command down the pipe: %s", ctx.obj["fifo"]) logger.debug("Sending the stop-daemon command down the pipe: %s", ctx.obj["fifo"])
with open(ctx.obj["fifo"], "w") as fifo: with open(ctx.obj["fifo"], "w") as fifo:
@ -207,7 +206,7 @@ def stop_daemon_command(ctx: click.Context) -> None:
@click.pass_context @click.pass_context
def stop_command(ctx: click.Context, name: T.Optional[str]) -> None: def stop_command(ctx: click.Context, name: T.Optional[str]) -> None:
""" """
Writes on the fifo. Invokes the stop. Stops a client.
""" """
logger.debug("Sending the stop command down the pipe: %s", ctx.obj["fifo"]) logger.debug("Sending the stop command down the pipe: %s", ctx.obj["fifo"])
name = _check_name(ctx.obj["lifo"], name) name = _check_name(ctx.obj["lifo"], name)
@ -256,7 +255,7 @@ def login_command(
force: bool, force: bool,
) -> None: ) -> None:
""" """
Writes on the fifo. Invokes the stop. Logs a client in using the provided credentials.
""" """
no_userpass = username is None or password is None no_userpass = username is None or password is None
if credfile is not None and no_userpass: if credfile is not None and no_userpass:
@ -301,7 +300,7 @@ def login_command(
@click.pass_context @click.pass_context
def logout_command(ctx: click.Context, name: T.Optional[str], force: bool) -> None: def logout_command(ctx: click.Context, name: T.Optional[str], force: bool) -> None:
""" """
Writes on the fifo. Invokes the stop. Logs a logged in client out.
""" """
logger.debug("Sending the logout command down the pipe: %s", ctx.obj["fifo"]) logger.debug("Sending the logout command down the pipe: %s", ctx.obj["fifo"])
name = _check_name(ctx.obj["lifo"], name) name = _check_name(ctx.obj["lifo"], name)
@ -316,7 +315,7 @@ def logout_command(ctx: click.Context, name: T.Optional[str], force: bool) -> No
@click.pass_context @click.pass_context
def reload_command(ctx: click.Context, name: T.Optional[str]) -> None: def reload_command(ctx: click.Context, name: T.Optional[str]) -> None:
""" """
Writes on the fifo. Invokes the reload. Resets a client to a clean state (discards the session).
""" """
logger.debug("Sending the reload command down the pipe: %s", ctx.obj["fifo"]) logger.debug("Sending the reload command down the pipe: %s", ctx.obj["fifo"])
name = _check_name(ctx.obj["lifo"], name) name = _check_name(ctx.obj["lifo"], name)
@ -330,7 +329,7 @@ def reload_command(ctx: click.Context, name: T.Optional[str]) -> None:
@click.pass_context @click.pass_context
def status_command(ctx: click.Context, name: T.Optional[str]) -> None: def status_command(ctx: click.Context, name: T.Optional[str]) -> None:
""" """
Writes on the fifo. Queries the status. Displays basic info on the state of a client.
""" """
try: try:
name = _check_name(ctx.obj["lifo"], name) name = _check_name(ctx.obj["lifo"], name)