aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2015-01-06 13:15:02 -0800
committerBrian Dolbec <dolsen@gentoo.org>2015-01-06 13:19:40 -0800
commit038dee3c65047d6b076379612db9e7540aba92c9 (patch)
treee90610734ac9c9e4250968366007fc491ff9669d /gkeys-gen
parentgkeys-gen: Setup.py updates for man page generation (diff)
downloadgentoo-keys-038dee3c65047d6b076379612db9e7540aba92c9.tar.gz
gentoo-keys-038dee3c65047d6b076379612db9e7540aba92c9.tar.bz2
gentoo-keys-038dee3c65047d6b076379612db9e7540aba92c9.zip
gkeygen/actions.py: Add list-specs action, example
Diffstat (limited to 'gkeys-gen')
-rw-r--r--gkeys-gen/gkeygen/actions.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/gkeys-gen/gkeygen/actions.py b/gkeys-gen/gkeygen/actions.py
index e118289..740d954 100644
--- a/gkeys-gen/gkeygen/actions.py
+++ b/gkeys-gen/gkeygen/actions.py
@@ -30,17 +30,28 @@ from gkeys.fileops import ensure_dirs
Action_Map = OrderedDict({
- 'gen-key': {
+ 'gen-key': {
'func': 'genkey',
'options': ['spec', 'dest'],
'desc': '''Generate a gpg key using a spec file''',
'long_desc': '''Generate a gpg key using a spec file''',
'example': '''''',
},
+ 'list-specs': {
+ 'func': 'list_specs',
+ 'options': [],
+ 'desc': '''List spec file definitions (spec names) found in the config''',
+ 'long_desc': '''List spec file definitions (spec names) found in the config.
+ The default-spec setting when the pkg was installed is set to glep-63-recommended.''',
+ 'example': '''$ gkey-gen list-specs
+
+ Gkey task results:
+ Specs defined: glep-63, default-spec, glep-63-recommended
+''',
+ },
})
-Available_Actions = list(Action_Map)
-
+Available_Actions = ['gen-key', 'list-specs']
LARRY = """
____________________
@@ -149,3 +160,11 @@ class Actions(object):
key_properties = urlopen(url).read()
return _unicode(key_properties.decode('utf-8')).format(name, email)
+
+ def list_specs(self, args):
+ '''List seed file definitions found in the config'''
+ specs = list(self.config.get_key('spec'))
+ return (True, {"Specs defined: %s\n"
+ % (", ".join(specs)): True})
+
+