Improve order of args and wording of '--help' text

This commit is contained in:
Calum Lind 2016-04-26 12:44:24 +01:00
parent a99e29642c
commit 69871506e1
3 changed files with 43 additions and 44 deletions

View File

@ -22,24 +22,23 @@ from deluge.ui.util import lang
def add_daemon_options(parser):
group = parser.add_argument_group(_("Daemon Options"))
group.add_argument("-u", "--ui-interface", metavar="<ip-addr>", action="store",
help=_("IP address to listen for UI connections"))
group.add_argument("-p", "--port", metavar="<port>", action="store", type=int,
help=_("The port the daemon will listen on"))
group.add_argument("-i", "--interface", metavar="<iface>", dest="listen_interface", action="store",
help=_("Interface daemon will listen for bittorrent connections on, must be an IP address"))
group.add_argument("-u", "--ui-interface", metavar="<iface>", action="store",
help=_("Interface daemon will listen for UI connections on, must be an IP address"))
help=_("Port to listen for UI connections on"))
group.add_argument("-i", "--interface", metavar="<ip-addr>", dest="listen_interface", action="store",
help=_("IP address to listen for BitTorrent connections"))
group.add_argument("-P", "--pidfile", metavar="<pid-file>", action="store",
help=_("Pidfile to store the process id"))
if not deluge.common.windows_check():
group.add_argument("-d", "--do-not-daemonize", dest="donot", action="store_true",
help=_("Do not fork or daemonize the daemon process"))
group.add_argument("-P", "--pidfile", metavar="<pidfile>", action="store",
help=_("Use a pidfile to store process id"))
if not deluge.common.windows_check():
help=_("Do not daemonize (fork) this process"))
group.add_argument("-U", "--user", metavar="<user>", action="store",
help=_("User to switch to. Only use it when starting as root"))
help=_("Change to this user on startup (Requires root)"))
group.add_argument("-g", "--group", metavar="<group>", action="store",
help=_("Group to switch to. Only use it when starting as root"))
group.add_argument("--read-only-config-keys", action="store", type=str, default="",
help=_("List of comma-separated config keys that will not be modified by set_config RPC."))
help=_("Change to this group on startup (Requires root)"))
group.add_argument("--read-only-config-keys", metavar="<comma-separated-keys>", action="store",
help=_("Config keys to be unmodified by `set_config` RPC"), type=str, default="")
def start_daemon(skip_start=False):

View File

@ -95,25 +95,26 @@ class BaseArgParser(argparse.ArgumentParser):
self.common_setup = False
self.group = self.add_argument_group(_("Common Options"))
self.group.add_argument("-h", "--help", action=HelpAction,
help=_("Print this help message"))
self.group.add_argument("-V", "--version", action="version", version="%(prog)s " + get_version(),
help=_("Show program's version info and exit"))
help=_("Print version information"))
self.group.add_argument("-v", action="version", version="%(prog)s " + get_version(),
help=argparse.SUPPRESS) # Deprecated arg
self.group.add_argument("-c", "--config", action="store", metavar="<config>",
self.group.add_argument("-c", "--config", metavar="<config>",
help=_("Set the config directory path"))
self.group.add_argument("-l", "--logfile", action="store", metavar="<logfile>",
self.group.add_argument("-l", "--logfile", metavar="<logfile>",
help=_("Output to specified logfile instead of stdout"))
self.group.add_argument("-L", "--loglevel", action="store", choices=deluge.log.levels, metavar="<level>",
help=_("Set the log level: %s" % ", ".join(deluge.log.levels)))
self.group.add_argument("--logrotate", action="store", nargs="?", const="2M", metavar="<max size>",
self.group.add_argument("-L", "--loglevel", choices=deluge.log.levels, metavar="<level>",
help=_("Set the log level (none, error, warning, info, debug)"))
self.group.add_argument("--logrotate", nargs="?", const="2M", metavar="<max-size>",
help=_("Enable logfile rotation, with optional maximum logfile size, "
"default: %(const)s (Logfile rotation count is 5)"))
self.group.add_argument("-q", "--quiet", action="store_true", default=False,
help=_("Quieten logging output, equal to `--loglevel none`"))
self.group.add_argument("--profile", metavar="<results file>", action="store", nargs="?", default=False,
help=_("Profile %(prog)s with cProfile. Prints results to stdout "
self.group.add_argument("-q", "--quiet", action="store_true",
help=_("Quieten logging output (Same as `--loglevel none`)"))
self.group.add_argument("--profile", metavar="<profile-file>", nargs="?", default=False,
help=_("Profile %(prog)s with cProfile. Outputs to stdout "
"unless a filename is specified"))
self.group.add_argument("-h", "--help", action=HelpAction, help=_("Show this help message and exit"))
def parse_args(self, *args):
options, remaining = super(BaseArgParser, self).parse_known_args(*args)

View File

@ -36,33 +36,32 @@ class Web(UI):
super(Web, self).__init__("web", *args, **kwargs)
self.__server = None
group = self.parser.add_argument_group(_("Web Options"))
group.add_argument("-b", "--base", metavar="<path>", action="store", default=None,
help=_("Set the base path that the ui is running on (proxying)"))
group = self.parser.add_argument_group(_("Web Server Options"))
group.add_argument("-i", "--interface", metavar="<ip_address>", action="store",
help=_("IP address for web server to listen on"))
group.add_argument("-p", "--port", metavar="<port>", type=int, action="store",
help=_("Port for web server to listen on"))
group.add_argument("-P", "--pidfile", metavar="<pidfile>", action="store",
help=_("Pidfile to store the process id"))
if not windows_check():
group.add_argument("-d", "--do-not-daemonize", dest="donotdaemonize", action="store_true", default=False,
help=_("Do not daemonize the web interface"))
group.add_argument("-f", "--fork", dest="donotdaemonize", action="store_false", help=argparse.SUPPRESS)
group.add_argument("-P", "--pidfile", metavar="<pidfile>", action="store", default=None,
help=_("Use pidfile to store process id"))
if not windows_check():
group.add_argument("-U", "--user", metavar="<user>", action="store", default=None,
help=_("User to switch to. Only use it when starting as root"))
group.add_argument("-g", "--group", metavar="<group>", action="store", default=None,
help=_("Group to switch to. Only use it when starting as root"))
group.add_argument("-i", "--interface", metavar="<interface>", action="store", default=None,
help=_("Binds the webserver to a specific IP address"))
group.add_argument("-p", "--port", metavar="<port>", type=int, action="store", default=None,
help=_("Sets the port to be used for the webserver"))
group.add_argument("-d", "--do-not-daemonize", dest="donotdaemonize", action="store_true",
help=_("Do not daemonize (fork) this process"))
group.add_argument("-f", "--fork", dest="donotdaemonize", action="store_false",
help=argparse.SUPPRESS) # Deprecated arg
group.add_argument("-U", "--user", metavar="<user>", action="store",
help=_("Change to this user on startup (Requires root)"))
group.add_argument("-g", "--group", metavar="<group>", action="store",
help=_("Change to this group on startup (Requires root)"))
group.add_argument("-b", "--base", metavar="<path>", action="store",
help=_("Set the base path that the ui is running on"))
try:
import OpenSSL
assert OpenSSL.__version__
except ImportError:
pass
else:
group.add_argument("--ssl", action="store_true", help=_("Forces the webserver to use ssl"))
group.add_argument("--no-ssl", action="store_true", help=_("Forces the webserver to disable ssl"))
group.add_argument("--ssl", action="store_true", help=_("Force the web server to use SSL"))
group.add_argument("--no-ssl", action="store_true", help=_("Force the web server to disable SSL"))
@property
def server(self):