fix: use docstrings for subcommands

This commit is contained in:
Daylin Morgan 2023-08-08 16:38:02 -05:00
parent 4ee497f2f7
commit 93d406b424
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -55,7 +55,7 @@ from typing import (
from urllib.error import HTTPError from urllib.error import HTTPError
from urllib.request import urlopen from urllib.request import urlopen
__version__ = "23.8a3" __version__ = "23.8a3-dev"
class Spinner: class Spinner:
@ -1882,7 +1882,7 @@ class Cli:
).update( ).update(
{ {
cmd: { cmd: {
subcmd: {"help": help, "aliases": [subcmd[0]]} subcmd: dict(description=help, aliases=[subcmd[0]])
for subcmd, help in subcmd_help for subcmd, help in subcmd_help
} }
for cmd, subcmd_help in ( for cmd, subcmd_help in (
@ -2019,7 +2019,9 @@ class Cli:
if subcmds: if subcmds:
subcmd_p = self._get_subcmd_parser(cmd_p, cmd) subcmd_p = self._get_subcmd_parser(cmd_p, cmd)
subcmd_cmd_p = subcmd_p.add_subparsers( subcmd_cmd_p = subcmd_p.add_subparsers(
title="subcommand", metavar="<sub-cmd>", required=True title="subcommand",
metavar="<sub-cmd>",
required=True,
) )
for subcmd, kwargs in subcmds.items(): for subcmd, kwargs in subcmds.items():
subcmd_cmd_p.add_parser( subcmd_cmd_p.add_parser(