enhanced help message thx to
@@ -33,34 +33,40 @@ def parse_cli():
# to ~/.i3/i3status.conf
i3status_config_file_default = "{}/.i3/i3status.conf".format(home_path)
+ class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter):
+ def _format_action_invocation(self, action):
+ metavar = self._format_args(action, action.dest.upper())
+ return "{} {}".format(", ".join(action.option_strings), metavar)
+
# command line options
parser = argparse.ArgumentParser(
description="The agile, python-powered, i3status wrapper"
)
parser = argparse.ArgumentParser(add_help=True)
+ parser = argparse.ArgumentParser(formatter_class=HelpFormatter)
parser.add_argument(
"-b",
"--dbus-notify",
action="store_true",
default=False,
dest="dbus_notify",
- help=(
- "use notify-send to send user notifications "
- "rather than i3-nagbar, "
- "requires a notification daemon eg dunst"
- ),
+ help="send notifications via dbus instead of i3-nagbar",
)
parser.add_argument(
"-c",
"--config",
action="store",
dest="i3status_conf",
+ metavar="FILE",
type=str,
default=i3status_config_file_default,
- help="path to i3status config file",
+ help="load config (default %(default)s)",
)
parser.add_argument(
- "-d", "--debug", action="store_true", help="be verbose in syslog"
+ "-d",
+ "--debug",
+ action="store_true",
+ help="enable debug logging in syslog and --log-file",
)
parser.add_argument(
"-g",
@@ -68,17 +74,15 @@ def parse_cli():
action="store_true",
default=False,
dest="gevent",
- help="enable gevent monkey patching (default False)",
+ help="enable gevent monkey patching",
)
parser.add_argument(
"-i",
"--include",
action="append",
dest="include_paths",
- help=(
- "include user-written modules from those "
- "directories (default ~/.i3/py3status)"
- ),
+ help="append additional user-defined module paths",
+ metavar="PATH",
)
parser.add_argument(
"-l",
@@ -87,22 +91,21 @@ def parse_cli():
dest="log_file",
type=str,
default=None,
- help="path to py3status log file",
+ metavar="FILE",
+ help="enable logging to FILE",
)
parser.add_argument(
"-n",
"--interval",
action="store",
dest="interval",
+ metavar="INT",
type=float,
default=1,
- help="update interval in seconds (default 1 sec)",
+ help="refresh interval in seconds for py3status",
)
parser.add_argument(
- "-s",
- "--standalone",
- action="store_true",
- help="standalone mode, do not use i3status",
+ "-s", "--standalone", action="store_true", help="run py3status without i3status"
)
parser.add_argument(
"-t",
@@ -111,7 +114,8 @@ def parse_cli():
dest="cache_timeout",
type=int,
default=60,
- help="default injection cache timeout in seconds (default 60 sec)",
+ metavar="INT",
+ help="default module cache timeout in seconds",
)
parser.add_argument(
"-m",
