public inbox for gentoo-keys@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ashish Gupta <ashmew2@gmail.com>
To: gentoo-keys@lists.gentoo.org
Subject: [gentoo-keys] [PATCH 1/3] gpg.py-Add-listkey-and-listkeys-functions
Date: Fri, 27 May 2016 13:59:55 +0000	[thread overview]
Message-ID: <CABH6M7LGdLGuLACJ=h4AnQCoTvp3j4PDkWYrJmc2Wfj0YHZitg@mail.gmail.com> (raw)

[-- 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


                 reply	other threads:[~2016-05-27 13:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABH6M7LGdLGuLACJ=h4AnQCoTvp3j4PDkWYrJmc2Wfj0YHZitg@mail.gmail.com' \
    --to=ashmew2@gmail.com \
    --cc=gentoo-keys@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox