1n1t
Advanced tools
Comparing version 1.0.22 to 1.0.23
66
index.js
@@ -22,10 +22,4 @@ var async = require('async'); | ||
var contentFirst = [ | ||
var content = [ | ||
{ | ||
type: 'confirm', | ||
name: 'commitWithInit', | ||
message: 'Would you want commit and initial push with init?', | ||
default: true | ||
}, | ||
{ | ||
type: 'input', | ||
@@ -38,46 +32,12 @@ name: 'url', | ||
} | ||
return 'Please enter a git url.'; | ||
} | ||
} | ||
]; | ||
] | ||
var contentSecond = [ | ||
{ | ||
type: 'input', | ||
name: 'message', | ||
message: 'What\'s your awesome hello new repo commit?', | ||
validate: function (value) { | ||
if (value.trim().length > 0) { | ||
return true; | ||
} | ||
return 'Please write down your best comments...'; | ||
} | ||
} | ||
]; | ||
function questions() { | ||
return new Promise(function(resolve, reject) { | ||
q(contentFirst) | ||
.then((output) => { | ||
if (output.commitWithInit) { | ||
q(contentSecond) | ||
.then((value) => { | ||
var obj = { | ||
message: value.message, | ||
url: output.url, | ||
new: true, | ||
} | ||
resolve(obj) | ||
}) | ||
.catch((err) => {reject(err);}) | ||
} else { | ||
var obj = { | ||
message: 'Awesome repository initialized with g3l.', | ||
url: output.url, | ||
new: true, | ||
} | ||
resolve(obj) | ||
} | ||
q(content) | ||
.then((value) => { | ||
resolve(output.url) | ||
}) | ||
@@ -94,16 +54,8 @@ .catch((err) => {reject(err);}) | ||
questions() | ||
.then((obj) => { | ||
E(`git init && git remote add origin ${obj.url.trim()}`) | ||
.then((url) => { | ||
E(`git init && git remote add origin ${url.trim()}`) | ||
.then((value) => { | ||
console.log(colors.green('Git init successfully.')); | ||
C({message: obj.message, new:true}) | ||
.then((value) => { | ||
console.log(value); | ||
resolve(obj) | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
reject(value) | ||
}) | ||
resolve('Git init successfully.') | ||
}) | ||
.catch((err) => {reject(err)}) | ||
}) | ||
@@ -110,0 +62,0 @@ }) |
{ | ||
"name": "1n1t", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"description": "Create github repository in programmatically.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2623
68