feat: password copied to clipboard

This commit is contained in:
Ruidy 2021-07-05 20:14:59 +02:00
parent 1c2da99c1a
commit cdc2dbe984
2 changed files with 8 additions and 2 deletions

View file

@ -7,4 +7,4 @@
- [x] Include symbols
- [x] Include numbers
- [ ] As a user I want the generated password to be copied to the clipboard
- [ ] As a user I want the generated password to be saved to a file
- [x] As a user I want the generated password to be saved to a file

View file

@ -1,4 +1,5 @@
import random as r
import subprocess
import typer
@ -19,7 +20,12 @@ def main(
),
) -> None:
seed = r.randint(0, 100) if random else 0
typer.echo(generate_password(seed, length, symbols, numbers))
password = generate_password(seed, length, symbols, numbers)
subprocess.run("pbcopy", universal_newlines=True, input=password)
typer.echo(f"🔐 {password}")
typer.echo("The password has been copied to your clipboard 😉")
if __name__ == "__main__":