public inbox for gentoo-keys@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-keys] [PATCH 1/3] gpg.py-Add-listkey-and-listkeys-functions
@ 2016-05-27 13:59 Ashish Gupta
  0 siblings, 0 replies; only message in thread
From: Ashish Gupta @ 2016-05-27 13:59 UTC (permalink / raw
  To: gentoo-keys

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0001-gpg.py-Add-listkey-and-listkeys-functions.patch --]
[-- Type: text/x-patch, Size: 2052 bytes --]

From 312ee8394fdf259474e4228b5fcc99a3867431e1 Mon Sep 17 00:00:00 2001
From: Ashish Gupta <ashmew2@gmail.com>
Date: Mon, 23 May 2016 21:46:16 +0000
Subject: [PATCH 1/3] gpg.py: Add listkey() and listkeys() functions

Add functions for handling --list-key and --list-keys. Both of these functions
have the same signature as the fingerprint() method. listkey() and listkeys()
both supply arguments after --list-key and --list-keys as inputfile parameter
to runGPG(). The inputfile parameter may be the name of a filename parameter
to gpg or a non-filename arguments supplied to --list-keys or --list-key such
as a user's email address (uid), key id (pub/sub) or key fingerprint.
---
 pyGPG/gpg.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pyGPG/gpg.py b/pyGPG/gpg.py
index 5aaf992..bff0908 100644
--- a/pyGPG/gpg.py
+++ b/pyGPG/gpg.py
@@ -111,6 +111,27 @@ class GPG(object):
             return GPGResult(gpg, results, extract_stdout=True)
         return GPGResult(gpg, results)
 
+    def listkey(self, id_string=None, outputfile=None):
+        '''Lists the keys with --list-key <argument>
+
+        @param id_string: string (optional) argument to --list-key
+        @param outputfile: string (optional) filepath to pass to
+                           gpg for it's output
+        @rtype GnuPGResult object
+        '''
+        return self.runGPG('list-key', inputfile=id_string,
+                           outputfile=outputfile)
+
+    def listkeys(self, id_string=None, outputfile=None):
+        '''Lists the keys with --list-keys <argument>
+
+        @param id_string: string (optional) argument to --list-keys
+        @param outputfile: string (optional) filepath to pass to
+                           gpg for it's output
+        @rtype GnuPGResult object
+        '''
+        return self.runGPG('list-keys', inputfile=id_string,
+                           outputfile=outputfile)
 
     def fingerprint(self, id_string=None, outputfile=None):
         '''Lists the key, with the fingerprint
-- 
2.4.10


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-27 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-27 13:59 [gentoo-keys] [PATCH 1/3] gpg.py-Add-listkey-and-listkeys-functions Ashish Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox