-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommandline.js
More file actions
executable file
·20 lines (16 loc) · 861 Bytes
/
commandline.js
File metadata and controls
executable file
·20 lines (16 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env node
const program = require('commander');
const path = require('path');
const package = require('./package.json');
const analyticsHtmlInjector = require('./lib/analyticsHtmlInjector');
require('colors');
program
.version(package.version, '-v, --version')
.description(package.description)
.option('-i, --input [inputFile]', 'HTML file to read for injection', "./index.html")
.option('-o, --output [outputFile]', 'Injected output file name', "./index.html")
.option('-G, --google <googleTrackingId>', 'Inject google analytics with provided tracking id (UA-XXXXX-Y)', /^UA\-\d{5,}\-\d$/)
.parse(process.argv);
program.inputFile = analyticsHtmlInjector.toAbsolutePath(program.inputFile);
program.outputFile = analyticsHtmlInjector.toAbsolutePath(program.outputFile);
analyticsHtmlInjector.injectGoogleAnalytics(program);