If there is a single item for a url, use it instead of prompting

This commit is contained in:
Guillermo Gonzalez 2022-04-01 14:51:49 -03:00
parent 63afed98d3
commit 5b11763ccf
1 changed files with 7 additions and 3 deletions

View File

@ -223,9 +223,13 @@ class OnePass:
raise cls.NoItemsFoundError(f"No items found for host {host}")
try:
credential = pipe_commands(
["echo", "\n".join(mapping.keys())], CMD_ITEM_SELECT
)
# if there is a single item, use that instead of prompting
if len(mapping) == 1:
credential = list(mapping.keys())[0]
else:
credential = pipe_commands(
["echo", "\n".join(mapping.keys())], CMD_ITEM_SELECT
)
except ExecuteError:
pass