summaryrefslogtreecommitdiff
path: root/u/process
diff options
context:
space:
mode:
Diffstat (limited to 'u/process')
-rw-r--r--u/process/argv.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/u/process/argv.ts b/u/process/argv.ts
index dca5098..396fa96 100644
--- a/u/process/argv.ts
+++ b/u/process/argv.ts
@@ -31,7 +31,9 @@ export const getArg = <K extends string, V>(
.flatMap((idx) =>
Optional.from(argv.at(idx)).map((_argv) => (_argv.includes('=') ? _argv.split('=')[1] : argv.at(idx + 1))),
)
- .map((next) => (isArgKey(next) ? whenValue.unspecified : whenValue.present(next)))
+ .filter((next) => !isArgKey(next))
+ .map((next) => whenValue.present(next))
+ .orSome(() => whenValue.unspecified)
.map((v) => Either.right<Error, V>(<V>v))
.get();
};