From 944dbcdd6ed6ef9e53bb522e59195bcc1ad7f222 Mon Sep 17 00:00:00 2001 From: Aryeh Harris Date: Wed, 18 Oct 2023 20:20:05 -0400 Subject: [PATCH] getTez: Throw error for unexpected argument --- getTez/getTez.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/getTez/getTez.ts b/getTez/getTez.ts index 6793f43..c8514ab 100755 --- a/getTez/getTez.ts +++ b/getTez/getTez.ts @@ -71,7 +71,7 @@ type GetTezArgs = { time?: boolean } -const parseCliArgs = (args: string | string[]) => { +const parseCliArgs = (args: string | string[]): GetTezArgs => { if (typeof args === "string") args = args.split(" ") const parsedArgs: GetTezArgs = { @@ -116,7 +116,11 @@ const parseCliArgs = (args: string | string[]) => { log(pkgJson.version) process.exit(0) default: - parsedArgs.address = arg || "" + if (!parsedArgs.address) { + parsedArgs.address = arg || "" + } else { + handleError(`Unexpected argument provided '${arg}'.`, DISPLAY_HELP) + } break } }