small improvements from our cli investigation

This commit is contained in:
Alex Grintsvayg 2019-06-04 09:39:33 -04:00
parent 798ba9acf8
commit 7063138e3c
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5
2 changed files with 5 additions and 3 deletions

View file

@ -121,7 +121,7 @@ class Toggle(Setting[bool]):
) )
parser.add_argument( parser.add_argument(
self.no_cli_name, self.no_cli_name,
help=f"Opposite of --{self.cli_name}", help=f"Opposite of {self.cli_name}",
dest=self.name, dest=self.name,
action="store_false", action="store_false",
default=NOT_SET default=NOT_SET

View file

@ -169,7 +169,7 @@ def add_command_parser(parent, command):
def get_argument_parser(): def get_argument_parser():
main = ArgumentParser( main = ArgumentParser(
'lbrynet', description='An interface to the LBRY Network.' 'lbrynet', description='An interface to the LBRY Network.', allow_abbrev=False,
) )
main.add_argument( main.add_argument(
'-v', '--version', dest='cli_version', action="store_true", '-v', '--version', dest='cli_version', action="store_true",
@ -192,8 +192,8 @@ def get_argument_parser():
help=('Enable debug output. Optionally specify loggers for which debug output ' help=('Enable debug output. Optionally specify loggers for which debug output '
'should selectively be applied.') 'should selectively be applied.')
) )
start.set_defaults(command='start', start_parser=start)
Config.contribute_to_argparse(start) Config.contribute_to_argparse(start)
start.set_defaults(command='start', start_parser=start, doc=start.format_help())
api = Daemon.get_api_definitions() api = Daemon.get_api_definitions()
groups = {} groups = {}
@ -239,6 +239,7 @@ def main(argv=None):
if args.help: if args.help:
args.start_parser.print_help() args.start_parser.print_help()
return 0 return 0
default_formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(name)s:%(lineno)d: %(message)s") default_formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(name)s:%(lineno)d: %(message)s")
file_handler = logging.handlers.RotatingFileHandler( file_handler = logging.handlers.RotatingFileHandler(
conf.log_file_path, maxBytes=2097152, backupCount=5 conf.log_file_path, maxBytes=2097152, backupCount=5
@ -264,6 +265,7 @@ def main(argv=None):
loop.set_debug(True) loop.set_debug(True)
else: else:
log.setLevel(logging.INFO) log.setLevel(logging.INFO)
if conf.share_usage_data: if conf.share_usage_data:
loggly_handler = get_loggly_handler() loggly_handler = get_loggly_handler()
loggly_handler.setLevel(logging.ERROR) loggly_handler.setLevel(logging.ERROR)