diff options
author | Florian Dold <florian@dold.me> | 2022-09-19 17:46:30 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-19 17:46:30 +0200 |
commit | a5525eab1e96d5b08fbb6442275b1e92f7f8d806 (patch) | |
tree | d03e01c84b051373778188f8f63005257f5073d8 /packages/taler-wallet-cli/src/index.ts | |
parent | f63765b9f7a089eb0f2a62d53f5ad1d56961fa1f (diff) | |
download | wallet-core-a5525eab1e96d5b08fbb6442275b1e92f7f8d806.tar.xz |
taler-util: fix CLI parsing for numberic options
Diffstat (limited to 'packages/taler-wallet-cli/src/index.ts')
-rw-r--r-- | packages/taler-wallet-cli/src/index.ts | 78 |
1 files changed, 35 insertions, 43 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index 5fd608f77..31e0b0f65 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -17,65 +17,60 @@ /** * Imports. */ -import os from "os"; +import { deepStrictEqual } from "assert"; import fs from "fs"; +import os from "os"; import path from "path"; -import { deepStrictEqual } from "assert"; // Polyfill for encoding which isn't present globally in older nodejs versions -import { TextEncoder, TextDecoder } from "util"; -// @ts-ignore -global.TextEncoder = TextEncoder; -// @ts-ignore -global.TextDecoder = TextDecoder; -import * as clk from "./clk.js"; -import { getTestInfo, runTests } from "./integrationtests/testrunner.js"; import { - PreparePayResultType, - setDangerousTimetravel, - classifyTalerUri, - TalerUriType, - RecoveryMergeStrategy, - Amounts, addPaytoQueryParams, + AgeRestriction, + Amounts, + classifyTalerUri, + clk, codecForList, codecForString, - Logger, Configuration, decodeCrock, - rsaBlind, - LogLevel, - setGlobalLogLevelFromString, - parsePaytoUri, - AgeRestriction, - getRandomBytes, encodeCrock, + getRandomBytes, j2s, + Logger, + parsePaytoUri, + PreparePayResultType, + RecoveryMergeStrategy, + rsaBlind, + setDangerousTimetravel, + setGlobalLogLevelFromString, + TalerUriType, } from "@gnu-taler/taler-util"; import { - NodeHttpLib, + CryptoDispatcher, getDefaultNodeWallet, - NodeThreadCryptoWorkerFactory, - walletCoreDebugFlags, - WalletApiOperation, - WalletCoreApiClient, - Wallet, getErrorDetailFromException, - CryptoDispatcher, - SynchronousCryptoWorkerFactory, nativeCrypto, - performanceNow, + NodeHttpLib, + NodeThreadCryptoWorkerFactory, summarizeTalerErrorDetail, + SynchronousCryptoWorkerFactory, + Wallet, + WalletApiOperation, + WalletCoreApiClient, + walletCoreDebugFlags, } from "@gnu-taler/taler-wallet-core"; -import { lintExchangeDeployment } from "./lint.js"; +import type { TalerCryptoInterface } from "@gnu-taler/taler-wallet-core/src/crypto/cryptoImplementation"; +import { TextDecoder, TextEncoder } from "util"; import { runBench1 } from "./bench1.js"; -import { runEnv1 } from "./env1.js"; -import { GlobalTestState, runTestWithState } from "./harness/harness.js"; import { runBench2 } from "./bench2.js"; import { runBench3 } from "./bench3.js"; -import { - TalerCryptoInterface, - TalerCryptoInterfaceR, -} from "@gnu-taler/taler-wallet-core/src/crypto/cryptoImplementation"; +import { runEnv1 } from "./env1.js"; +import { GlobalTestState, runTestWithState } from "./harness/harness.js"; +import { getTestInfo, runTests } from "./integrationtests/testrunner.js"; +import { lintExchangeDeployment } from "./lint.js"; +// @ts-ignore +global.TextEncoder = TextEncoder; +// @ts-ignore +global.TextDecoder = TextDecoder; // This module also serves as the entry point for the crypto // thread worker, and thus must expose these two handlers. @@ -390,13 +385,10 @@ walletCli help: "Withdraw with a taler://withdraw/ URI", }) .requiredArgument("uri", clk.STRING) - .maybeOption("restrictAge", ["--restrict-age"], clk.STRING) + .maybeOption("restrictAge", ["--restrict-age"], clk.INT) .action(async (args) => { const uri = args.withdraw.uri; - const restrictAge = - args.withdraw.restrictAge == null - ? undefined - : Number.parseInt(args.withdraw.restrictAge); + const restrictAge = args.withdraw.restrictAge; console.log(`age restriction requested (${restrictAge})`); await withWallet(args, async (wallet) => { const withdrawInfo = await wallet.client.call( |