From e3d7dd26d39fc30151a2880541b7381161b63a5e Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 27 Mar 2017 17:54:02 +0200 Subject: [PATCH] Refactor main.py. No longer need to change it if a new plugin is added (except for the command line) --- glances/main.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/glances/main.py b/glances/main.py index a82410ad..141addc3 100644 --- a/glances/main.py +++ b/glances/main.py @@ -367,20 +367,7 @@ Examples of use: self.args = args # Export is only available in standalone or client mode (issue #614) - export_tag = ( - args.export_csv or - args.export_cassandra or - args.export_couchdb or - args.export_elasticsearch or - args.export_influxdb or - args.export_kafka or - args.export_opentsdb or - args.export_prometheus or - args.export_rabbitmq or - args.export_riemann or - args.export_statsd or - args.export_zeromq - ) + export_tag = any([getattr(args, a) for a in args.__dict__ if a.startswith('export_')]) if WINDOWS and export_tag: # On Windows, export is possible but only in quiet mode # See issue #1038