blob: b37e49ccff566d926d7b7c4ff40416510d4b0fab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
const path = require('path');
const Book = require('../models/book');
const createNodeFS = require('../fs/node');
/**
Return a book instance to work on from
command line args/kwargs
@param {Array} args
@param {Object} kwargs
@return {Book}
*/
function getBook(args, kwargs) {
const input = path.resolve(args[0] || process.cwd());
const logLevel = kwargs.log;
const fs = createNodeFS(input);
const book = Book.createForFS(fs);
return book.setLogLevel(logLevel);
}
module.exports = getBook;
|