-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
33 lines (26 loc) · 925 Bytes
/
index.js
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
33
'use strict';
var gitProperties = require('./lib/gitProperties');
var commandLineArgs = require('command-line-args')
// library's entry point
var execute = function () {
// define allows command line arguments when calling library
const optionDefinitions = [
{name: 'directory', alias: 'd', type: String}
]
// convert command line arguments to object
const options = commandLineArgs(optionDefinitions);
// define callback function to call when git.properties file has been written or when an error doing so occurs.
var callback = function (writeSuccess) {
if (writeSuccess) {
//exit with a 'success' code
process.exit(0);
} else {
//exit with a 'failure' code
process.exit(1);
}
}
// write git.properties file
gitProperties.write(options.directory, callback);
}
execute();
module.exports = execute;