File tree Expand file tree Collapse file tree 3 files changed +26
-18
lines changed
Expand file tree Collapse file tree 3 files changed +26
-18
lines changed Original file line number Diff line number Diff line change @@ -449,6 +449,7 @@ const FLAG_REGEXP =
449449 * or `options.boolean` is set for that argument name.
450450 *
451451 * @param args An array of command line arguments.
452+ * @param options Options for the parse function.
452453 *
453454 * @typeParam TArgs Type of result.
454455 * @typeParam TDoubleDash Used by `TArgs` for the result.
@@ -496,7 +497,17 @@ export function parseArgs<
496497 TAliasNames extends string = string ,
497498> (
498499 args : string [ ] ,
499- {
500+ options ?: ParseOptions <
501+ TBooleans ,
502+ TStrings ,
503+ TCollectable ,
504+ TNegatable ,
505+ TDefaults ,
506+ TAliases ,
507+ TDoubleDash
508+ > ,
509+ ) : Args < TArgs , TDoubleDash > {
510+ const {
500511 "--" : doubleDash = false ,
501512 alias = { } as NonNullable < TAliases > ,
502513 boolean = false ,
@@ -506,16 +517,7 @@ export function parseArgs<
506517 collect = [ ] ,
507518 negatable = [ ] ,
508519 unknown : unknownFn = ( i : string ) : unknown => i ,
509- } : ParseOptions <
510- TBooleans ,
511- TStrings ,
512- TCollectable ,
513- TNegatable ,
514- TDefaults ,
515- TAliases ,
516- TDoubleDash
517- > = { } ,
518- ) : Args < TArgs , TDoubleDash > {
520+ } = options ?? { } ;
519521 const aliasMap : Map < string , Set < string > > = new Map ( ) ;
520522 const booleanSet = new Set < string > ( ) ;
521523 const stringSet = new Set < string > ( ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export type PromptSecretOptions = {
2929 * Use an empty `mask` if you don't want to show any character.
3030 *
3131 * @param message The prompt message to show to the user.
32+ * @param options The options for the prompt.
3233 * @returns The string that was entered or `null` if stdin is not a TTY.
3334 *
3435 * @example Usage
@@ -43,8 +44,10 @@ export type PromptSecretOptions = {
4344 */
4445export function promptSecret (
4546 message = "Secret" ,
46- { mask = "*" , clear } : PromptSecretOptions = { } ,
47+ options ? : PromptSecretOptions ,
4748) : string | null {
49+ const { mask = "*" , clear } = options ?? { } ;
50+
4851 if ( ! input . isTerminal ( ) ) {
4952 return null ;
5053 }
Original file line number Diff line number Diff line change @@ -139,6 +139,8 @@ export class Spinner {
139139 /**
140140 * Creates a new spinner.
141141 *
142+ * @param options Options for the spinner.
143+ *
142144 * @example Usage
143145 * ```ts no-assert
144146 * import { Spinner } from "@std/cli/spinner";
@@ -147,12 +149,13 @@ export class Spinner {
147149 * spinner.stop();
148150 * ```
149151 */
150- constructor ( {
151- spinner = DEFAULT_SPINNER ,
152- message = "" ,
153- interval = DEFAULT_INTERVAL ,
154- color,
155- } : SpinnerOptions = { } ) {
152+ constructor ( options ?: SpinnerOptions ) {
153+ const {
154+ spinner = DEFAULT_SPINNER ,
155+ message = "" ,
156+ interval = DEFAULT_INTERVAL ,
157+ color,
158+ } = options ?? { } ;
156159 this . #spinner = spinner ;
157160 this . message = message ;
158161 this . #interval = interval ;
You can’t perform that action at this time.
0 commit comments