Download:
child 29:c04a4faec835
parent 27:a5f866114e79
28:7f7fdce01952
Anton Shestakov <av6@dwimlabs.net>, Mon, 18 Jul 2016 19:17:54 +0800
rollbot: move logging options above main config, split the lines Helps keeping options and their defaults closer to each other.

1 файлов изменено, 9 вставок(+), 5 удалений(-) [+]
rollbot.py file | annotate | diff | comparison | revisions
--- a/rollbot.py Mon Jul 18 19:17:30 2016 +0800
+++ b/rollbot.py Mon Jul 18 19:17:54 2016 +0800
@@ -231,6 +231,15 @@
'-c', '--config', type=FileType('r'),
help='configuration file (YAML)')
+ group = parser.add_mutually_exclusive_group()
+ extra = dict(action='store_const', dest='loglevel', default=logging.INFO)
+ group.add_argument(
+ '-q', '--quiet', const=logging.ERROR,
+ help='set logging to ERROR', **extra)
+ group.add_argument(
+ '-d', '--debug', const=logging.DEBUG,
+ help='set logging to DEBUG', **extra)
+
group = parser.add_argument_group(
'main configuration',
'options that can also be specified in the configuration file')
@@ -239,11 +248,6 @@
group.add_argument('-n', '--nick', help='MUC nickname (default: rollbot)')
group.add_argument('--prefix', help='command prefix (default: !)')
- group = parser.add_mutually_exclusive_group()
- extra = dict(action='store_const', dest='loglevel', default=logging.INFO)
- group.add_argument('-q', '--quiet', help='set logging to ERROR', const=logging.ERROR, **extra)
- group.add_argument('-d', '--debug', help='set logging to DEBUG', const=logging.DEBUG, **extra)
-
args = parser.parse_args()
config = yaml.safe_load(args.config) if hasattr(args, 'config') else {}