mirror of
https://github.com/github/codeql-action.git
synced 2025-12-28 02:00:12 +08:00
23 lines
625 B
JavaScript
Executable File
23 lines
625 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
const getSize = require('../');
|
|
const argv = require('gar')(process.argv.slice(2));
|
|
const path = require('path');
|
|
// --folder or -f or last argument passed
|
|
const folder = argv.folder || argv.f || argv._[argv._.length - 1];
|
|
|
|
if (!folder) {
|
|
console.error('missing folder argument');
|
|
console.error('\n Usage:\n');
|
|
console.error('get-folder-size --folder=/home/alex/www');
|
|
process.exit(1);
|
|
}
|
|
|
|
const ignore = argv.ignore ? new RegExp(argv.ignore) : null;
|
|
|
|
getSize(path.resolve(folder), ignore, (err, bytes) => {
|
|
if (err) { throw err; }
|
|
|
|
console.log((bytes / 1024 / 1024).toFixed(2) + ' Mb');
|
|
});
|