From 826dfa8d629f8b8b4d3cb9f83bb59ef9c5a0f3b2 Mon Sep 17 00:00:00 2001
From: Marko Mecina <marko.mecina@univie.ac.at>
Date: Thu, 5 May 2022 16:50:33 +0200
Subject: [PATCH] add help message to MIB import script

---
 Ccs/tools/import_mib.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Ccs/tools/import_mib.py b/Ccs/tools/import_mib.py
index 2a28933..9a9e347 100755
--- a/Ccs/tools/import_mib.py
+++ b/Ccs/tools/import_mib.py
@@ -97,14 +97,18 @@ def import_mib():
 
 if __name__ == '__main__':
 
-    if len(sys.argv) > 1:
+    if '-c' in sys.argv:
+        MIBDIR = '/home/user/space/mib'  # directory containing the SCOS2000 *.dat files
+        DBNAME = 'mib_schema_test'  # SQL schema name to be created
+        DBURL = 'mysql://user:password@127.0.0.1'  # credentials of MySQL account
+    elif len(sys.argv) > 1:
         MIBDIR, DBNAME, dbuser = sys.argv[1:4]
         dbpw = getpass.getpass()
         DBURL = 'mysql://{}:{}@127.0.0.1'.format(dbuser, dbpw)
     else:
-        MIBDIR = '/home/user/space/mib'  # directory containing the SCOS2000 *.dat files
-        DBNAME = 'mib_schema_test'  # SQL schema name to be created
-        DBURL = 'mysql://user:password@127.0.0.1'  # credentials of MySQL account
+        print('USAGE: ./import_mib.py <MIBDIR> <DBSCHEMA> <DBUSERNAME> [-c]\n'
+              'Options:\n\t-c\tUse configuration in script, any command line arguments will be ignored')
+        sys.exit()
 
     generate_wbsql()
     create_schema()
-- 
GitLab