Просмотр исходного кода

fix duplicate prompts (#502)

This is a small change which reorders/consolidates how lesspass prompts the user for the required information. Before this, if a user supplied the -p tag while also providing site, login, and or a password in the positional arguments, the prompt would ask for the values again. This instead checks for the values and skips asking if they exist. For example, lesspass sitename -p will only prompt for the login and the password
pull/544/head
Trevor Leach 4 лет назад
committed by Guillaume Vincent
Родитель
Сommit
033f8cd30c
1 измененных файлов: 8 добавлений и 4 удалений
  1. +8
    -4
      cli/lesspass/core.py

+ 8
- 4
cli/lesspass/core.py Просмотреть файл

@@ -23,15 +23,19 @@ def main(args=sys.argv[1:]):
sys.exit(3)

if args.prompt:
args.site = getpass.getpass("Site: ")
args.login = getpass.getpass("Login: ")
if not args.site:
args.site = getpass.getpass("Site: ")
if not args.login:
args.login = getpass.getpass("Login: ")

if not args.master_password:
args.master_password = getpass.getpass("Master Password: ")

if not args.site:
print("ERROR argument SITE is required but was not provided.")
sys.exit(4)

if not args.master_password:
args.master_password = getpass.getpass("Master Password: ")
if not args.master_password:
print("ERROR argument MASTER_PASSWORD is required but was not provided")
sys.exit(5)



Загрузка…
Отмена
Сохранить