in integ/scripts/node/stack-order.ts [119:152]
function parseProgramArguments(): ProgramArguments {
let orderType: OrderType = OrderType.DEPLOY;
let manifestPath: string = DEFAULT_MANIFEST_PATH;
let reverseFlag: string | undefined;
// Strip the first two arguments (node interpreter and the path to this script)
const args = process.argv.slice(2);
if (args.length === 2) {
// Two arguments passed. Ensure the first is the "-r" flag
[ reverseFlag, manifestPath ] = args;
// Validate first arg is the -r flag
if (reverseFlag !== '-r') {
throw new Error(`Unexpected argument: "${reverseFlag}"`);
}
orderType = OrderType.DESTROY;
} else if (args.length === 1) {
if (args[0] === '-r') {
orderType = OrderType.DESTROY;
} else {
// A single argument is passed containing the manifest path
manifestPath = process.argv[2];
}
} else if (args.length > 2) {
throw new Error(`Unexpected number of arguments (${args.length})`);
}
return {
manifestPath,
orderType,
};
}