diff --git a/README.md b/README.md index 8e13b01..fbec6fb 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/main.py b/app/main.py index 042b22d..5b9a8d7 100644 --- a/app/main.py +++ b/app/main.py @@ -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__":