diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-23 15:05:32 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-23 15:05:32 +0100 |
commit | f052aacee1140f211ebb9454157fa7a3604005cf (patch) | |
tree | f784d8b9fd70bd94b754e13d26e6f6dd548b9908 /lib/cli/helper.js | |
parent | 13e2ff8035d9a93e4ee8eb79ec71ac92e6f2bf7e (diff) | |
download | gitbook-f052aacee1140f211ebb9454157fa7a3604005cf.zip gitbook-f052aacee1140f211ebb9454157fa7a3604005cf.tar.gz gitbook-f052aacee1140f211ebb9454157fa7a3604005cf.tar.bz2 |
Add .gitbook to locate book inside repository
Diffstat (limited to 'lib/cli/helper.js')
-rw-r--r-- | lib/cli/helper.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/cli/helper.js b/lib/cli/helper.js index 9510b49..e62c8d9 100644 --- a/lib/cli/helper.js +++ b/lib/cli/helper.js @@ -9,6 +9,8 @@ var JSONOutput = require('../output/json'); var WebsiteOutput = require('../output/website'); var EBookOutput = require('../output/ebook'); +var nodeFS = new NodeFS(); + var LOG_OPTION = { name: 'log', description: 'Minimum log level to display', @@ -39,14 +41,12 @@ var FORMATS = { function bookCmd(fn) { return function(args, kwargs) { var input = path.resolve(args[0] || process.cwd()); - var book = new Book({ - fs: new NodeFS(), - root: input, - + return Book.setup(nodeFS, input, { logLevel: kwargs.log + }) + .then(function(book) { + return fn(book, args.slice(1), kwargs); }); - - return fn(book, args.slice(1), kwargs); }; } @@ -94,6 +94,7 @@ function ebookCmd(format) { } module.exports = { + nodeFS: nodeFS, bookCmd: bookCmd, outputCmd: outputCmd, ebookCmd: ebookCmd, |