export function parseArgs(argv: string[]): CliOptions {
let explicitVersion: string | null = null;
let fromGateway = false;
let rootDir = path.resolve(".");
let sync = true;
for (let index = 0; index < argv.length; index += 1) { const arg = argv[index]; switch (arg) { case"--from-gateway": {
fromGateway = true; break;
} case"--version": {
explicitVersion = argv[index + 1] ?? null;
index += 1; break;
} case"--no-sync": {
sync = false; break;
} case"--root": { const value = argv[index + 1]; if (!value) { thrownew Error("Missing value for --root.");
}
rootDir = path.resolve(value);
index += 1; break;
} case"-h": case"--help": {
console.log(`${usage()}\n`);
process.exit(0);
} default: { thrownew Error(`Unknown argument: ${arg}`);
}
}
}
if (fromGateway === (explicitVersion !== null)) { thrownew Error("Choose exactly one of --from-gateway or --version <YYYY.M.D>.");
}
if (explicitVersion !== null && !explicitVersion.trim()) { thrownew Error("Missing value for --version.");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.