-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathsourcebit.js
More file actions
executable file
·32 lines (27 loc) · 1.1 KB
/
sourcebit.js
File metadata and controls
executable file
·32 lines (27 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
const commander = require('commander');
const sourcebit = require('../index');
const path = require('path');
const pkg = require('../package.json');
commander
.version(pkg.version)
.command('fetch')
.option('-c, --configPath', 'specify the location of the configuration file')
.option('-C, --cache', 'force Sourcebit to use a filesystem cache, even when `watch` is disabled')
.option('-w, --watch', 'run continuously in watch mode')
.option('-q, --quiet', 'disable logging messages to the console')
.action(({ cache, configPath: customConfigPath, quiet, watch }) => {
const configPath = path.resolve(process.cwd(), customConfigPath || 'sourcebit.js');
const config = require(configPath);
const runtimeParameters = {
cache,
quiet,
watch
};
sourcebit.fetch(config, runtimeParameters);
});
commander.on('command:*', () => {
console.error('Invalid command: %s\nSee --help for a list of available commands.', commander.args.join(' '));
process.exit(1);
});
commander.parse(process.argv);