diff --git a/README.md b/README.md index 0290c35..d6085d6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Fork of one of the tools by [Max Korenkov](https://github.com/mkorenkov) separat Rename `config.ini.sample` to `config.ini`, and edit the fields to match your login info and repository info. Store the config file in the same folder as the `gh-issues-import.py` script, or store it in a different folder, using the `--config ` option to specify which config file to load in. -**Warning:** The password is stored in plaintext, so avoid storing the config file in a public repository. To avoid this, you can instead pass the username and/or password as arguments by using the `-u ` and `-p ` flags respectively. +**Warning:** The password is stored in plaintext, so avoid storing the config file in a public repository. To avoid this, you can instead pass the username and/or password as arguments by using the `-u ` and `-p ` flags respectively. If the username or password is not passed in from either of these locations, the user will be prompted for them when the script runs. Run the script with the following command to import all open issues into the repository defined in the config: diff --git a/gh-issues-import.py b/gh-issues-import.py index 557c884..4050919 100755 --- a/gh-issues-import.py +++ b/gh-issues-import.py @@ -49,6 +49,13 @@ def init_config(): config.set('settings', 'import-milestone', str(not args.ignore_milestone)) config.set('settings', 'import-labels', str(not args.ignore_labels)) + # Prompt for username/password if none is provided in either the config or an argument + if not config.has_option('login', 'username') : + config.set('login', 'username', input("Enter your username for GitHub.com: ")) + if not config.has_option('login', 'password') : + import getpass + config.set('login', 'password', getpass.getpass("Enter your password for GitHub.com: ")) + #TODO: Make sure no config values are missing global source_url, target_url