summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr00t <bts@square-r00t.net>2021-07-05 02:50:42 -0400
committerr00t <bts@square-r00t.net>2021-07-05 02:50:42 -0400
commit8278c55cab4361f955b31b99a282ffe4fc6fa548 (patch)
tree6e8c19653bffecb6dde3f29bc4f31c998b1ad801
parent9d018be8aafb22af6dd0faef5b50948db81a784b (diff)
parent75580b43cceea4ebab3c9e413427b03b5f5711f1 (diff)
downloadBDisk-4.x_rewrite.tar.xz
Merge branch '4.x_rewrite' of square-r00t.net:bdisk into 4.x_rewrite4.x_rewrite
-rw-r--r--bdisk/utils.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/bdisk/utils.py b/bdisk/utils.py
index 36a4c5e..f2f3f90 100644
--- a/bdisk/utils.py
+++ b/bdisk/utils.py
@@ -257,6 +257,55 @@ class prompts(object):
while not _a:
if 'algo' in gpg_vals['attribs'] and a == 'keysize':
_algo = gpg_vals['attribs']['algo']
+ _choices = _attribs['keysize']['choices'][_algo]
+ _dflt = _attribs['keysize']['default'][_algo]
+ else:
+ _choices = _attribs[a]['choices']
+ _dflt = _attribs[a]['default']
+ _a = (input(
+ ('\nWhat should be {0}? (Default is {1}.)\nChoices:\n'
+ '\n\t{2}\n\n{3}: ').format(
+ _attribs[a]['text'],
+ _dflt,
+ '\n\t'.join(_choices),
+ a.title()
+ )
+ )).strip().lower()
+ if _a == '':
+ _a = _dflt
+ elif _a not in _choices:
+ _a = _dflt
+ else:
+ print('_dflt:', _dflt)
+ print('_choices:', _choices)
+ print('Invalid selection. Retrying.')
+ _a = None
+ continue
+ gpg_vals['attribs'][a] = _a
+ for p in _params:
+ _p = (input(
+ ('\nWhat is the {0} for the subkey?\n{1}: ').format(
+ p, p.title())
+ ))
+ if p == 'name':
+ if _p.strip() == '':
+ print('Name cannot be blank.')
+ _p = None
+ while not _p:
+ _p = input(('\n{0}: ').format(p.title()))
+ if _p.strip() == '':
+ print('Trying again.')
+ _p = None
+ continue
+ continue
+ elif _params[p]:
+ if not _params[p](_p):
+ print('Invalid entry. Retrying...')
+ _p = None
+ continue
+ else:
+ gpg_vals['params'][p] = _p
+=======
_choices = _strs['attribs']['keysize']['choices'][_algo]
_dflt = _strs['attribs']['keysize']['default'][_algo]
else:
@@ -294,6 +343,7 @@ class prompts(object):
)
_p = input('{0}: '.format(_p.title()))
gpg_vals['params'][p] = _p
+>>>>>>> 69b6ec60d05d64a9e23e9a0707a0323f960a2936
return(gpg_vals)
def hash_select(self, prompt = '',