docs: improve documentation for cli actions

This commit is contained in:
Peter F. Patel-Schneider 2024-08-23 09:00:31 -04:00
parent 4578f5f6f1
commit ae39ac46ba
3 changed files with 10 additions and 5 deletions

View File

@ -136,9 +136,9 @@ It is possible to end up with an unusable system, for example by having no
way to do a mouse left click, so exercise caution when remapping keys or way to do a mouse left click, so exercise caution when remapping keys or
buttons that are needed to operate your system. buttons that are needed to operate your system.
## Solaar command line interface ## Solaar command-line interface
Solaar also has a command line interface that can do most of what can be Solaar also has a command-line interface that can do most of what can be
done using the main window. For more information on the done using the main window. For more information on the
command line interface, run `solaar --help` to see the commands and command line interface, run `solaar --help` to see the commands and
then `solaar <command> --help` to see the arguments to any of the commands. then `solaar <command> --help` to see the arguments to any of the commands.

View File

@ -35,7 +35,7 @@ def _create_parser():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog=NAME.lower(), add_help=False, epilog=f"For details on individual actions, run `{NAME.lower()} <action> --help`." prog=NAME.lower(), add_help=False, epilog=f"For details on individual actions, run `{NAME.lower()} <action> --help`."
) )
subparsers = parser.add_subparsers(title="actions", help="optional action to perform") subparsers = parser.add_subparsers(title="actions", help="command-line action to perform")
sp = subparsers.add_parser("show", help="show information about devices") sp = subparsers.add_parser("show", help="show information about devices")
sp.add_argument( sp.add_argument(

View File

@ -84,8 +84,13 @@ def _parse_arguments():
) )
arg_parser.add_argument("--tray-icon-size", type=int, help="explicit size for tray icons") arg_parser.add_argument("--tray-icon-size", type=int, help="explicit size for tray icons")
arg_parser.add_argument("-V", "--version", action="version", version="%(prog)s " + __version__) arg_parser.add_argument("-V", "--version", action="version", version="%(prog)s " + __version__)
arg_parser.add_argument("--help-actions", action="store_true", help="print help for the optional actions") arg_parser.add_argument("--help-actions", action="store_true", help="describe the command-line actions")
arg_parser.add_argument("action", nargs=argparse.REMAINDER, choices=cli.actions, help="optional actions to perform") arg_parser.add_argument(
"action",
nargs=argparse.REMAINDER,
choices=cli.actions,
help="command-line action to perform (optional); append ' --help' to show args",
)
args = arg_parser.parse_args() args = arg_parser.parse_args()