Skip to content

Commit

Permalink
Copying related improvement
Browse files Browse the repository at this point in the history
Copy password to clipboard after --
* new password creation
* without printing it on screen
  • Loading branch information
Yadnyawalk Tale committed Jan 25, 2020
1 parent 3e19963 commit 49b2803
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pygenpass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from pygenpass.password import version
from pygenpass.password import modpass
from pygenpass.password import allpass
from pygenpass.password import copypass


@click.group()
Expand All @@ -42,6 +43,7 @@ def main():
main.add_command(savepass)
main.add_command(delpass)
main.add_command(version)
main.add_command(copypass)

if __name__ == "__main__":
main()
10 changes: 10 additions & 0 deletions pygenpass/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""
import click # Used for command line interface
import diceware # Used for creating password
import pyperclip
from pygenpass.database import DatabaseConnection
from datetime import date
from beautifultable import BeautifulTable # display output in table format
Expand Down Expand Up @@ -95,6 +96,7 @@ def createpass():
"""Used for taking input from user to create password"""
portal_name = click.prompt("Enter portal name", default="None")
password = diceware.get_passphrase()
pyperclip.copy(password)
creation_date = date.today()
email = click.prompt("Enter email id", default="None")
portal_url = click.prompt("Enter portal url", default="None")
Expand All @@ -115,3 +117,11 @@ def showpass():
print("No records found")
else:
print(spass)


@click.command("copy", help="Copy password")
@click.argument("portal_name")
def copypass(portal_name):
password = db_obj.show_data(portal_name)
pyperclip.copy(password)

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ diceware>=0.9.6
click>=7.0
beautifultable>=0.5.0
setuptools>=40.0.0
pyperclip>=1.7.0
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ install_requires =
beautifultable
click
diceware
pyperclip

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit 49b2803

Please sign in to comment.