commit:     767eef2583f7282f8215279d6f725508dd277a63
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  3 18:05:30 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan  3 18:21:23 2015 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=767eef25

cli.py: Remove redundant code

---
 gkeys-gen/gkeygen/cli.py   | 16 +++++++---------
 gkeys-ldap/gkeyldap/cli.py |  8 ++++++--
 gkeys/gkeys/cli.py         |  8 +++-----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/gkeys-gen/gkeygen/cli.py b/gkeys-gen/gkeygen/cli.py
index 3c55b38..561bf9f 100644
--- a/gkeys-gen/gkeygen/cli.py
+++ b/gkeys-gen/gkeygen/cli.py
@@ -4,12 +4,10 @@
 from __future__ import print_function
 
 
-import argparse
 import os
 import sys
 
 from gkeys.config import GKeysConfig
-from gkeys.log import log_levels, set_logger
 from gkeys.base import CliBase
 from gkeygen.actions import Actions, Available_Actions, Action_Map
 
@@ -46,14 +44,14 @@ class Main(CliBase):
                      Defaults to sys.argv[1:]
         """
         if args:
-            ok = self.setup(args, configs)
-            if ok:
-                return self.run(self.parse_args(args))
+            ok = self.setup(args, [])
         else:
             args = self.parse_args(sys.argv[1:])
-            configs = [os.path.join(self.config['configdir'],'gkeys.conf'),
-            os.path.join(self.config['configdir'],'gkeys-gen.conf')]
+            configs = [
+                os.path.join(self.config['configdir'],'gkeys.conf'),
+                os.path.join(self.config['configdir'],'gkeys-gen.conf'),
+                ]
             ok = self.setup(args, configs)
-            if ok:
-                return self.run(args)
+        if ok:
+            return self.run(args)
         return False

diff --git a/gkeys-ldap/gkeyldap/cli.py b/gkeys-ldap/gkeyldap/cli.py
index b4a9904..d0f57cf 100644
--- a/gkeys-ldap/gkeyldap/cli.py
+++ b/gkeys-ldap/gkeyldap/cli.py
@@ -47,7 +47,11 @@ class Main(CliBase):
                      Defaults to sys.argv[1:]
         """
         if args:
-            return self.run(self.parse_args(args))
+            ok = self.setup(args, [])
         else:
-            return self.run(self.parse_args(sys.argv[1:]))
+            args = self.parse_args(sys.argv[1:])
+            ok = self.setup(args, 
os.path.join(self.config['configdir'],'gkeys.conf'))
+        if ok:
+            return self.run(args)
+        return False
 

diff --git a/gkeys/gkeys/cli.py b/gkeys/gkeys/cli.py
index 347f658..f266f6c 100644
--- a/gkeys/gkeys/cli.py
+++ b/gkeys/gkeys/cli.py
@@ -52,12 +52,10 @@ class Main(CliBase):
                      Defaults to sys.argv[1:]
         """
         if args:
-            ok = self.setup(args)
-            if ok:
-                return self.run(self.parse_args(args))
+            ok = self.setup(args, [])
         else:
             args = self.parse_args(sys.argv[1:])
             ok = self.setup(args, 
os.path.join(self.config['configdir'],'gkeys.conf'))
-            if ok:
-                return self.run(args)
+        if ok:
+            return self.run(args)
         return False

Reply via email to