Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Copying related improvement #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pygenpass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import click

from pygenpass.password import allpass
from pygenpass.password import copypass
from pygenpass.password import createpass
from pygenpass.password import delpass
from pygenpass.password import modpass
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()
16 changes: 12 additions & 4 deletions pygenpass/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from datetime import date
import click # Used for command line interface
import diceware # Used for creating password
import pyperclip

import click
import diceware
from beautifultable import BeautifulTable

from datetime import date
from pygenpass.database import DatabaseConnection

db_obj = DatabaseConnection()
Expand Down Expand Up @@ -96,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 @@ -116,3 +117,10 @@ 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