cli parsing
This commit is contained in:
parent
2fb6e8f11f
commit
ecc7b5e76e
@ -421,6 +421,13 @@ export class CommandGroup<GN extends keyof any, TG> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parsedArgs[this.argKey].help) {
|
||||||
|
this.printHelp(progname, parents);
|
||||||
|
process.exit(0);
|
||||||
|
throw Error("not reached");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (let i = posArgIndex; i < this.arguments.length; i++) {
|
for (let i = posArgIndex; i < this.arguments.length; i++) {
|
||||||
const d = this.arguments[i];
|
const d = this.arguments[i];
|
||||||
if (d.required) {
|
if (d.required) {
|
||||||
@ -456,12 +463,6 @@ export class CommandGroup<GN extends keyof any, TG> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsedArgs[this.argKey].help) {
|
|
||||||
this.printHelp(progname, parents);
|
|
||||||
process.exit(0);
|
|
||||||
throw Error("not reached");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundSubcommand) {
|
if (foundSubcommand) {
|
||||||
foundSubcommand.run(
|
foundSubcommand.run(
|
||||||
progname,
|
progname,
|
||||||
|
@ -504,7 +504,9 @@ testCli
|
|||||||
});
|
});
|
||||||
|
|
||||||
testCli
|
testCli
|
||||||
.subcommand("testPayCmd", "test-pay", { help: "create contract and pay" })
|
.subcommand("testPayCmd", "test-pay", { help: "Create contract and pay." })
|
||||||
|
.requiredOption("merchant", ["-m", "--mechant-url"], clk.STRING)
|
||||||
|
.requiredOption("apikey", ["-k", "--mechant-api-key"], clk.STRING)
|
||||||
.requiredOption("amount", ["-a", "--amount"], clk.STRING)
|
.requiredOption("amount", ["-a", "--amount"], clk.STRING)
|
||||||
.requiredOption("summary", ["-s", "--summary"], clk.STRING, {
|
.requiredOption("summary", ["-s", "--summary"], clk.STRING, {
|
||||||
default: "Test Payment",
|
default: "Test Payment",
|
||||||
@ -513,8 +515,8 @@ testCli
|
|||||||
const cmdArgs = args.testPayCmd;
|
const cmdArgs = args.testPayCmd;
|
||||||
console.log("creating order");
|
console.log("creating order");
|
||||||
const merchantBackend = new MerchantBackendConnection(
|
const merchantBackend = new MerchantBackendConnection(
|
||||||
"https://backend.test.taler.net/",
|
args.testPayCmd.merchant,
|
||||||
"sandbox",
|
args.testPayCmd.apikey,
|
||||||
);
|
);
|
||||||
const orderResp = await merchantBackend.createOrder(
|
const orderResp = await merchantBackend.createOrder(
|
||||||
cmdArgs.amount,
|
cmdArgs.amount,
|
||||||
|
Loading…
Reference in New Issue
Block a user