Files
codeql-action/node_modules/glob-hash/bin/glob-hash
2020-12-09 21:28:55 +01:00

54 lines
1.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
var collect = require('../lib/collect');
var globHash = require('../lib/glob-hash');
var version = require('../package.json').version;
var options = require('commander')
.version(version)
.option(
'-i, --include <glob>',
'Files to include. Mandatory. May be used multiple times.',
collect,
[]
)
.option(
'-e, --exclude [glob]',
'Files to exclude. May be used multiple times.',
collect,
[]
)
.option(
'-a, --algorithm [string]',
'The hashing algorithm to use. Defaults to "sha256".'
)
.option(
'-f, --files',
'Show matched files and exit.'
)
.option(
'-j, --jail [path]',
'A jail path. Reading outside the jail path will throw an error.'
)
// add filenames to hash
.option(
'-n, --filenames',
'Include filenames in the hash.'
)
.parse(process.argv);
globHash(options)
.then(
function(result) {
if (Array.isArray(result)) {
console.log(result.join('\n'));
} else {
console.log(result.toString());
}
process.exit(0);
},
function(error) {
console.log(error.toString());
process.exit(1);
}
);