From 43cdb1e4be67758f9482f97883ec6c0d7b0ff472 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Fri, 4 Oct 2019 13:59:31 +0100
Subject: [PATCH] Command to remove groups

---
 epicyon.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/epicyon.py b/epicyon.py
index 81ca2e480..3919c19e7 100644
--- a/epicyon.py
+++ b/epicyon.py
@@ -115,6 +115,9 @@ parser.add_argument('-g','--addgroup', dest='addgroup', \
 parser.add_argument('-r','--rmaccount', dest='rmaccount', \
                     type=str,default=None, \
                     help='Remove an account')
+parser.add_argument('--rmgroup', dest='rmgroup', \
+                    type=str,default=None, \
+                    help='Remove a group')
 parser.add_argument('--pass','--password', dest='password', \
                     type=str,default=None, \
                     help='Set a password for an account')
@@ -955,6 +958,9 @@ if args.addgroup:
         print('Group creation failed')
     sys.exit()
 
+if args.rmgroup:
+    args.rmaccount=args.rmgroup
+
 if args.rmaccount:
     if '@' in args.rmaccount:
         nickname=args.rmaccount.split('@')[0]
@@ -965,8 +971,11 @@ if args.rmaccount:
             print('Use the --domain option to set the domain name')
             sys.exit()
     if removeAccount(baseDir,nickname,domain,port):
-        print('Account for '+handle+' was removed')
-    sys.exit()
+        if not args.rmgroup:
+            print('Account for '+handle+' was removed')
+        else:
+            print('Group '+handle+' was removed')
+        sys.exit()
 
 if args.changepassword:
     if len(args.changepassword)!=2: