mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 05:56: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) {
|
if (error) {
|
||||||
return cb(error);
|
return cb(error);
|
||||||
}
|
}
|
||||||
|
if (repoInfo) {
|
||||||
questions[0].default = repoInfo.projectName;
|
questions[0].default = repoInfo.projectName;
|
||||||
questions[1].default = repoInfo.projectOwner;
|
questions[1].default = repoInfo.projectOwner;
|
||||||
|
}
|
||||||
inquirer.prompt(questions, function treatAnswers(answers) {
|
inquirer.prompt(questions, function treatAnswers(answers) {
|
||||||
var config = {
|
var config = {
|
||||||
projectName: answers.projectName,
|
projectName: answers.projectName,
|
||||||
|
|
|
@ -21,6 +21,10 @@ function getRemoteOriginData(cb) {
|
||||||
|
|
||||||
function parse(originUrl) {
|
function parse(originUrl) {
|
||||||
var result = /:(\w+)\/([A-Za-z0-9-_]+)/.exec(originUrl);
|
var result = /:(\w+)\/([A-Za-z0-9-_]+)/.exec(originUrl);
|
||||||
|
if (!result) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
projectOwner: result[1],
|
projectOwner: result[1],
|
||||||
projectName: result[2]
|
projectName: result[2]
|
||||||
|
|
Loading…
Reference in a new issue