summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJames Phillpotts <jphillpotts@scottlogic.co.uk>2014-04-08 10:00:10 +0100
committerJames Phillpotts <jphillpotts@scottlogic.co.uk>2014-04-08 10:00:10 +0100
commitfa2f82d52f34b725483f0fd55be3cc9b04f7dc9b (patch)
treefc426d79573cf36fc4b3e975eaf36f34e3bf1a26 /bin
parent58a90886daa0f12f4f25cfe1c1378f455e9eb6a9 (diff)
downloadgitbook-fa2f82d52f34b725483f0fd55be3cc9b04f7dc9b.zip
gitbook-fa2f82d52f34b725483f0fd55be3cc9b04f7dc9b.tar.gz
gitbook-fa2f82d52f34b725483f0fd55be3cc9b04f7dc9b.tar.bz2
Tidy up use of github, and make error more descriptive
Diffstat (limited to 'bin')
-rw-r--r--bin/build.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/build.js b/bin/build.js
index 9f3ad1d..a712c12 100644
--- a/bin/build.js
+++ b/bin/build.js
@@ -25,18 +25,17 @@ var buildFunc = function(dir, options) {
})
.then(function(repoID) {
var title = options.title;
+ var githubID = options.github || repoID;
- if (!title) {
- var githubID = options.github || repoID;
-
- if(!githubID) {
- throw new Error('Needs a githubID (username/repo). Either set repo origin to a github repo or use the -g flag');
- }
-
+ if (!title && !githubID) {
+ throw new Error('Needs either a title or a githubID (username/repo).\n'+
+ ' If using github, either set repo origin to a github repo or use the -g flag.\n'+
+ ' For title, use the -t flag.');
+ } else if (!title) {
var parts = githubID.split('/', 2);
var user = parts[0], repo = parts[1];
- title = options.title || utils.titleCase(repo);
+ title = utils.titleCase(repo);
}
return generate.folder(