@syntropysoft/praetorian
Version:
Praetorian CLI – A universal multi-environment configuration validator for DevSecOps teams. Validate, compare, and secure YAML/ENV files with ease.
65 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLIParser = void 0;
class CLIParser {
/**
* Parse command line arguments
*/
parse(args) {
const options = {};
let config = '';
let i = 0;
while (i < args.length) {
const arg = args[i];
if (arg === '--all') {
options.all = true;
}
else if (arg === '--env' && i + 1 < args.length) {
options.env = args[i + 1];
i++;
}
else if (arg === '--environments' && i + 1 < args.length) {
options.environments = args[i + 1];
i++;
}
else if (arg === '--verbose') {
options.verbose = true;
}
else if (arg === '--strict') {
options.strict = true;
}
else if (arg === '--fail-fast') {
options.failFast = true;
}
else if (arg && !arg.startsWith('--') && !config) {
config = arg || '';
}
i++;
}
const command = args[0] || '';
const subcommand = args[1];
return {
command,
subcommand,
config,
options
};
}
/**
* Check if help is requested
*/
isHelpRequested(args) {
return args.length === 0 ||
args.includes('--help') ||
args.includes('-h') ||
args.includes('help');
}
/**
* Check if version is requested
*/
isVersionRequested(args) {
return args.includes('--version') || args.includes('-v');
}
}
exports.CLIParser = CLIParser;
//# sourceMappingURL=CLIParser.js.map