mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
Don't break if there is no git remote info
This commit is contained in:
parent
31af204714
commit
dfc20fc8d9
2 changed files with 8 additions and 2 deletions
|
@ -54,8 +54,10 @@ module.exports = function prompt(cb) {
|
|||
if (error) {
|
||||
return cb(error);
|
||||
}
|
||||
questions[0].default = repoInfo.projectName;
|
||||
questions[1].default = repoInfo.projectOwner;
|
||||
if (repoInfo) {
|
||||
questions[0].default = repoInfo.projectName;
|
||||
questions[1].default = repoInfo.projectOwner;
|
||||
}
|
||||
inquirer.prompt(questions, function treatAnswers(answers) {
|
||||
var config = {
|
||||
projectName: answers.projectName,
|
||||
|
|
|
@ -21,6 +21,10 @@ function getRemoteOriginData(cb) {
|
|||
|
||||
function parse(originUrl) {
|
||||
var result = /:(\w+)\/([A-Za-z0-9-_]+)/.exec(originUrl);
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
projectOwner: result[1],
|
||||
projectName: result[2]
|
||||
|
|
Loading…
Reference in a new issue