use %(default) in argparse

This commit is contained in:
Sebastien Bourdeauducq 2015-03-23 20:02:14 +01:00
parent b597483913
commit bd145bbabc
2 changed files with 3 additions and 4 deletions

View File

@ -22,10 +22,10 @@ def get_argparser():
help="hostname or IP address to bind to") help="hostname or IP address to bind to")
group.add_argument( group.add_argument(
"--port-notify", default=3250, type=int, "--port-notify", default=3250, type=int,
help="TCP port to listen to for notifications (default: 3250)") help="TCP port to listen to for notifications (default: %(default)d)")
group.add_argument( group.add_argument(
"--port-control", default=3251, type=int, "--port-control", default=3251, type=int,
help="TCP port to listen to for control (default: 3251)") help="TCP port to listen to for control (default: %(default)d)")
verbosity_args(parser) verbosity_args(parser)
return parser return parser

View File

@ -54,8 +54,7 @@ def simple_network_args(parser, default_port):
group.add_argument("--bind", default="::1", group.add_argument("--bind", default="::1",
help="hostname or IP address to bind to") help="hostname or IP address to bind to")
group.add_argument("-p", "--port", default=default_port, type=int, group.add_argument("-p", "--port", default=default_port, type=int,
help="TCP port to listen to (default: {})" help="TCP port to listen to (default: %(default)d)")
.format(default_port))
def init_logger(args): def init_logger(args):