Skip to content

Commit

Permalink
Print credentials managers as a table
Browse files Browse the repository at this point in the history
  • Loading branch information
dmach committed Mar 24, 2022
1 parent 2f52a8d commit 88a8a0c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion osc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,18 @@ def select_credentials_manager_descr():
if not credentials.has_keyring_support():
print('To use keyrings please install python%d-keyring.' % sys.version_info.major)
creds_mgr_descriptors = credentials.get_credentials_manager_descriptors()

rows = []
for i, creds_mgr_descr in enumerate(creds_mgr_descriptors, 1):
print('%d) %s (%s)' % (i, creds_mgr_descr.name(), creds_mgr_descr.description()))#
rows += [str(i), creds_mgr_descr.name(), creds_mgr_descr.description()]

from .core import build_table
headline = ('NUM', 'NAME', 'DESCRIPTION')
table = build_table(len(headline), rows, headline)
print()
for row in table:
print(row)

i = raw_input('Select credentials manager: ')
if not i.isdigit():
sys.exit('Invalid selection')
Expand Down

0 comments on commit 88a8a0c

Please sign in to comment.