Skip to main content Link Search Menu Expand Document (external link)

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>>

Source

Since v1.0.0

getFishCompletions

Signature

declare const getFishCompletions: <A>(self: Command<A>, programName: string) => Effect<Array<string>>

Source

Since v1.0.0

getHelp

Signature

declare const getHelp: <A>(self: Command<A>, config: CliConfig) => HelpDoc

Source

Since v1.0.0

getNames

Signature

declare const getNames: <A>(self: Command<A>) => HashSet<string>

Source

Since v1.0.0

getSubcommands

Signature

declare const getSubcommands: <A>(self: Command<A>) => HashMap<string, Command<unknown>>

Source

Since v1.0.0

getUsage

Signature

declare const getUsage: <A>(self: Command<A>) => Usage

Source

Since v1.0.0

getZshCompletions

Signature

declare const getZshCompletions: <A>(self: Command<A>, programName: string) => Effect<Array<string>>

Source

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>
}

Source

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>
}

Source

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>
}

Source

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>
}

Source

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>> }>>>
}

Source

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>
}

Source

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 }>

Source

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 }>

Source

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 {}

Source

Since v1.0.0

symbols

TypeId

Signature

declare const TypeId: unique symbol

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = typeof TypeId

Source

Since v1.0.0

utils

Command (namespace)

Source

Since v1.0.0

Variance (interface)

Signature

export interface Variance<A> {
  readonly [TypeId]: {
    readonly _A: (_: never) => A
  }
}

Source

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
  }>

Source

Since v1.0.0

ParsedUserInputCommand (type alias)

Signature

type { readonly name: Name; readonly value: ValueType; } = Command.ComputeParsedType<{
    readonly name: Name
    readonly value: ValueType
  }>

Source

Since v1.0.0

GetParsedType (type alias)

Signature

type GetParsedType<C> = C extends Command<infer P> ? P : never

Source

Since v1.0.0

ComputeParsedType (type alias)

Signature

type ComputeParsedType<A> = { [K in keyof A]: A[K] } extends infer X ? X : never

Source

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]

Source

Since v1.0.0