From aea65c7ec717003e67cf6469b1b39852b1378174 Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Sep 26 2016 17:16:50 +0000 Subject: Let Click manage the prompt --- diff --git a/pagure_importer/commands/github.py b/pagure_importer/commands/github.py index 5aae121..77ed4c6 100644 --- a/pagure_importer/commands/github.py +++ b/pagure_importer/commands/github.py @@ -1,5 +1,4 @@ import click -import getpass import pagure_importer from pagure_importer.app import app, REPO_PATH from pagure_importer.utils.importer_github import GithubImporter @@ -10,23 +9,19 @@ from pagure_importer.utils import ( ) -def form_github_issues(): - github_username = raw_input('Enter you Github Username: ') - github_password = getpass.getpass('Enter your github password: ') - github_project_name = raw_input('Enter github project name like: "pypingou/pagure" without quotes: ') - return (github_username, github_password, github_project_name) - - @app.command() -def github(): - github_username, github_password, github_project_name = form_github_issues() +@click.option('--username', prompt="Enter your Github Username: ") +@click.option('--password', prompt=True, hide_input=True) +@click.option('--project', + prompt='Enter github project name like: pypingou/pagure ') +def github(username, password, project): gen_json = raw_input( 'Do you want to generate jsons for project\'s contributers and issue commentors? (y/n): ') if gen_json == 'n': github_importer = GithubImporter( - github_username=github_username, - github_password=github_password, - github_project_name=github_project_name) + github_username=username, + github_password=password, + github_project_name=project) repos = pagure_importer.utils.display_repo() if repos: