@black-flag/core • Docs
@black-flag/core / util / Program
Program<
CustomCliArguments
,CustomExecutionContext
>:Omit
<_Program
<FrameworkArguments
<CustomExecutionContext
> &CustomCliArguments
>,"command"
|"onFinishCommand"
|"showHelpOnFail"
|"version"
|"help"
|"exitProcess"
|"commandDir"
|"parse"
|"parsed"
|"parseSync"
|"argv"
> &object
Represents a pre-configured yargs instance ready for argument parsing and execution.
Program
is essentially a drop-in replacement for the Argv
type exported
by yargs but with several differences and should be preferred.
command: (
command
,description
,builder
,handler
,middlewares
,deprecated
) =>Program
<CustomCliArguments
,CustomExecutionContext
>
Internal
• command: string
[]
• description: string
| false
• builder: (yargs
, helpOrVersionSet
) => Argv
<object
> | Record
<string
, never
>
• handler
• middlewares: []
• deprecated: string
| boolean
Program
<CustomCliArguments
, CustomExecutionContext
>
_Program.command
command_deferred:
Program
<CustomCliArguments
,CustomExecutionContext
>["command"
]
Internal
Identical to yargs::command
except its execution is enqueued and
deferred until Program.command_finalize_deferred is called.
_Program.command
command_finalize_deferred: () =>
void
Internal
void
Program.command_deferred
showHelpOnFail: (
enabled
) =>Program
<CustomCliArguments
,CustomExecutionContext
>
Like yargs::showHelpOnFail
except (1) it also determines if help text is
shown when executing an unimplemented parent command and (2) it has no
second message
parameter. If you want to output some specific error
message, use a configuration hook or yargs::epilogue
.
Invoking this method will affect all programs in your command hierarchy, not just the program on which it was invoked.
• enabled: boolean
Program
<CustomCliArguments
, CustomExecutionContext
>
_Program.showHelpOnFail
• CustomCliArguments extends Record
<string
, unknown
> = Record
<string
, unknown
>
• CustomExecutionContext extends ExecutionContext
= ExecutionContext