[PATCH] Added -q option to koji moshimoshi for suppressing output

riehecky at fnal.gov riehecky at fnal.gov
Mon May 5 14:57:30 UTC 2014


From: Pat Riehecky <riehecky at fnal.gov>

---
 cli/koji |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/cli/koji b/cli/koji
index 088c505..2dd3dcb 100755
--- a/cli/koji
+++ b/cli/koji
@@ -6138,20 +6138,22 @@ def handle_moshimoshi(options, session, args):
     "Introduce yourself"
     usage = _("usage: %prog moshimoshi [options]")
     parser = OptionParser(usage=usage)
+    parser.add_option("-q", action="store_true", help=_("only print unsuccessful connections"))
     (options, args) = parser.parse_args(args)
     if len(args) != 0:
         parser.error(_("This command takes no arguments"))
         assert False
     activate_session(session)
     u = session.getLoggedInUser()
-    if not u:
-        print "Not authenticated"
-        u = {'name' : 'anonymous user'}
-    print "%s, %s!" % (random.choice(greetings), u["name"],)
-    print ""
-    print "You are using the hub at %s" % (session.baseurl,)
-    if u.get("krb_principal", None) is not None:
-        print "Authenticated via Kerberos principal %s" % (u["krb_principal"])
+    if not parser.q:
+        if not u:
+            print "Not authenticated"
+            u = {'name' : 'anonymous user'}
+        print "%s, %s!" % (random.choice(greetings), u["name"],)
+        print ""
+        print "You are using the hub at %s" % (session.baseurl,)
+        if u.get("krb_principal", None) is not None:
+            print "Authenticated via Kerberos principal %s" % (u["krb_principal"])
 
 def handle_help(options, session, args):
     "List available commands"
-- 
1.7.1



More information about the buildsys mailing list