CommandDescriptor.ts overview
Since v1.0.0
Exports Grouped by Category
combinators
getBashCompletions
Signature
declare const getBashCompletions: <A>(self: Command<A>, programName: string) => Effect<Array<string>>
Since v1.0.0
getFishCompletions
Signature
declare const getFishCompletions: <A>(self: Command<A>, programName: string) => Effect<Array<string>>
Since v1.0.0
getHelp
Signature
declare const getHelp: <A>(self: Command<A>, config: CliConfig) => HelpDoc
Since v1.0.0
getNames
Signature
declare const getNames: <A>(self: Command<A>) => HashSet<string>
Since v1.0.0
getSubcommands
Signature
declare const getSubcommands: <A>(self: Command<A>) => HashMap<string, Command<unknown>>
Since v1.0.0
getUsage
Signature
declare const getUsage: <A>(self: Command<A>) => Usage
Since v1.0.0
getZshCompletions
Signature
declare const getZshCompletions: <A>(self: Command<A>, programName: string) => Effect<Array<string>>
Since v1.0.0
map
Signature
declare const map: {
<A, B>(f: (a: A) => B): (self: Command<A>) => Command<B>
<A, B>(self: Command<A>, f: (a: A) => B): Command<B>
}
Since v1.0.0
mapEffect
Signature
declare const mapEffect: {
<A, B>(f: (a: A) => Effect<B, ValidationError, FileSystem | Path | Terminal>): (self: Command<A>) => Command<B>
<A, B>(self: Command<A>, f: (a: A) => Effect<B, ValidationError, FileSystem | Path | Terminal>): Command<B>
}
Since v1.0.0
parse
Signature
declare const parse: {
(
args: ReadonlyArray<string>,
config: CliConfig
): <A>(self: Command<A>) => Effect<CommandDirective<A>, ValidationError, FileSystem | Path | Terminal>
<A>(
self: Command<A>,
args: ReadonlyArray<string>,
config: CliConfig
): Effect<CommandDirective<A>, ValidationError, FileSystem | Path | Terminal>
}
Since v1.0.0
withDescription
Signature
declare const withDescription: {
(description: string | HelpDoc): <A>(self: Command<A>) => Command<A>
<A>(self: Command<A>, description: string | HelpDoc): Command<A>
}
Since v1.0.0
withSubcommands
Signature
declare const withSubcommands: {
<
const Subcommands extends readonly [
readonly [id: unknown, command: Command<any>],
...Array<readonly [id: unknown, command: Command<any>]>
]
>(
subcommands: [...Subcommands]
): <A>(
self: Command<A>
) => Command<Command.ComputeParsedType<A & Readonly<{ subcommand: Option<Command.Subcommands<Subcommands>> }>>>
<
A,
const Subcommands extends readonly [
readonly [id: unknown, command: Command<any>],
...Array<readonly [id: unknown, command: Command<any>]>
]
>(
self: Command<A>,
subcommands: [...Subcommands]
): Command<Command.ComputeParsedType<A & Readonly<{ subcommand: Option<Command.Subcommands<Subcommands>> }>>>
}
Since v1.0.0
wizard
Signature
declare const wizard: {
(
prefix: ReadonlyArray<string>,
config: CliConfig
): <A>(self: Command<A>) => Effect<Array<string>, ValidationError | QuitException, FileSystem | Path | Terminal>
<A>(
self: Command<A>,
prefix: ReadonlyArray<string>,
config: CliConfig
): Effect<Array<string>, ValidationError | QuitException, FileSystem | Path | Terminal>
}
Since v1.0.0
constructors
make
Signature
declare const make: <Name extends string, OptionsType = void, ArgsType = void>(
name: Name,
options?: Options<OptionsType>,
args?: Args<ArgsType>
) => Command<{ readonly name: Name; readonly options: OptionsType; readonly args: ArgsType }>
Since v1.0.0
prompt
Signature
declare const prompt: <Name extends string, A>(
name: Name,
prompt: Prompt<A>
) => Command<{ readonly name: Name; readonly value: A }>
Since v1.0.0
models
Command (interface)
A Command
represents a command in a command-line application.
Every command-line application will have at least one command: the application itself. Other command-line applications may support multiple commands.
Signature
export interface Command<A> extends Command.Variance<A>, Pipeable {}
Since v1.0.0
symbols
TypeId
Signature
declare const TypeId: unique symbol
Since v1.0.0
TypeId (type alias)
Signature
type TypeId = typeof TypeId
Since v1.0.0
utils
Command (namespace)
Since v1.0.0
Variance (interface)
Signature
export interface Variance<A> {
readonly [TypeId]: {
readonly _A: (_: never) => A
}
}
Since v1.0.0
ParsedStandardCommand (type alias)
Signature
type { readonly name: Name; readonly options: OptionsType; readonly args: ArgsType; } = Command.ComputeParsedType<{
readonly name: Name
readonly options: OptionsType
readonly args: ArgsType
}>
Since v1.0.0
ParsedUserInputCommand (type alias)
Signature
type { readonly name: Name; readonly value: ValueType; } = Command.ComputeParsedType<{
readonly name: Name
readonly value: ValueType
}>
Since v1.0.0
GetParsedType (type alias)
Signature
type GetParsedType<C> = C extends Command<infer P> ? P : never
Since v1.0.0
ComputeParsedType (type alias)
Signature
type ComputeParsedType<A> = { [K in keyof A]: A[K] } extends infer X ? X : never
Since v1.0.0
Subcommands (type alias)
Signature
type Subcommands<A> = {
[I in keyof A]: A[I] extends readonly [infer Id, Command<infer Value>] ? readonly [id: Id, value: Value] : never
}[number]
Since v1.0.0