Function
arg
(
argv: string[],
spec: T,
stopAtPositional = true,
permissive = false,
)
Source from the content-addressed store, hash-verified
| 12 | * Wrap arg to return an error instead of throwing |
| 13 | */ |
| 14 | export function arg<T extends Arg.Spec>( |
| 15 | argv: string[], |
| 16 | spec: T, |
| 17 | stopAtPositional = true, |
| 18 | permissive = false, |
| 19 | ): Arg.Result<T> | Error { |
| 20 | try { |
| 21 | return Arg(spec, { argv, stopAtPositional, permissive }) |
| 22 | } catch (e: any) { |
| 23 | return e |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Check if result is an error |
Tested by
no test coverage detected