Пример #1
0
def main(args=sys.argv[1:]):
    args = parse_args(args)
    if args.version:
        print(__version__)
        sys.exit(0)
    error, help_message = validate_args(args)
    if args.help:
        print_help(help_message, long=True)
        sys.exit(0)
    if error:
        print_help(help_message)
        sys.exit(0)
    profile, master_password = create_profile(args)
    if not master_password:
        master_password = getpass.getpass("Master Password: "******"Copied to clipboard")
        except Exception as e:
            print("Copy failed, we are sorry")
            print("Can you send us an email at [email protected]\n")
            print("-" * 80)
            print("Object: [LessPass][cli] Copy issue on %s" %
                  platform.system())
            print("Hello,")
            print("I got an issue with LessPass cli software.\n")
            traceback.print_exc()
            print("-" * 80)
    else:
        print(generated_password)
Пример #2
0
 def test_validate_args_no_opposite_rules_lowercase(self):
     error, message = validate_args(
         parse_args(["site", "-l", "--no-lowercase"]))
     self.assertTrue(error)
     self.assertTrue(
         "Can't have -l (--lowercase) and --no-lowercase at the same time"
         in message)
Пример #3
0
 def test_validate_args_no_opposite_rules_symbols(self):
     error, message = validate_args(
         parse_args(["site", "-s", "--no-symbols"]))
     self.assertTrue(error)
     self.assertTrue(
         "Can't have -s (--symbols) and --no-symbols at the same time" in
         message)
Пример #4
0
 def test_validate_args_no_opposite_rules_digits(self):
     error, message = validate_args(
         parse_args(["site", "-d", "--no-digits"]))
     self.assertTrue(error)
     self.assertTrue(
         "Can't have -d (--digits) and --no-digits at the same time" in
         message)
Пример #5
0
 def test_validate_args_concat_errors(self):
     _, message = validate_args(
         parse_args(["site", "-u", "--no-uppercase", "-l", "--no-lowercase"])
     )
     self.assertTrue(
         "Can't have -l (--lowercase) and --no-lowercase at the same time" in message
     )
     self.assertTrue(
         "Can't have -u (--uppercase) and --no-uppercase at the same time" in message
     )
Пример #6
0
 def test_validate_args_no_site(self):
     error, message = validate_args(parse_args([]))
     self.assertTrue(error)
     self.assertTrue(
         "SITE is a required argument" in message
     )
Пример #7
0
 def test_validate_args_site_optional_with_prompt(self):
     error, message = validate_args(parse_args(["--prompt"]))
     self.assertFalse(error)
     self.assertTrue("SITE is a required argument" not in message)