Skip to content

CommandDescriptor

19 exports Added in v1.0.0 Source

Combinators

Signature

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

Signature

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

getHelp

Added in v1.0.0 Source

Signature

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

getNames

Added in v1.0.0 Source

Signature

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

Signature

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

getUsage

Added in v1.0.0 Source

Signature

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

Signature

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

map

Added in v1.0.0 Source

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

mapEffect

Added in v1.0.0 Source

Signature

declare const mapEffect: {
  <A, B>(f: (a: A) => Effect<B, ValidationError, any>): (self: Command<A>) => Command<B>;
  <A, B>(self: Command<A>, f: (a: A) => Effect<B, ValidationError, any>): Command<B>;
};

parse

Added in v1.0.0 Source

Signature

declare const parse: {
  (args: readonly Array<string>, config: CliConfig): <A>(self: Command<A>) => Effect<CommandDirective<A>, ValidationError, any>;
  <A>(self: Command<A>, args: readonly Array<string>, config: CliConfig): Effect<CommandDirective<A>, ValidationError, any>;
}

Signature

declare const withDescription: {
  (description: string | HelpDoc): <A>(self: Command<A>) => Command<A>;
  <A>(self: Command<A>, description: string | HelpDoc): Command<A>;
};

Signature

declare const withSubcommands: {
  <
    Subcommands extends readonly [
      readonly [unknown, Command<any>],
      readonly [unknown, Command<any>],
    ],
  >(
    subcommands: [...Array<Subcommands>],
  ): <A>(self: Command<A>) => Command<
    ComputeParsedType<
      A &
        Readonly<{
          subcommand: Option<Command.Subcommands<Subcommands>>;
        }>
    >
  >;
  <
    A,
    Subcommands extends readonly [
      readonly [unknown, Command<any>],
      readonly [unknown, Command<any>],
    ],
  >(
    self: Command<A>,
    subcommands: [...Array<Subcommands>],
  ): Command<
    ComputeParsedType<
      A &
        Readonly<{
          subcommand: Option<Command.Subcommands<Subcommands>>;
        }>
    >
  >;
};

wizard

Added in v1.0.0 Source

Signature

declare const wizard: {
  (prefix: readonly Array<string>, config: CliConfig): <A>(self: Command<A>) => Effect<Array<string>, any, any>;
  <A>(self: Command<A>, prefix: readonly Array<string>, config: CliConfig): Effect<Array<string>, any, any>;
}

Constructors

make

Added in v1.0.0 Source

Signature

declare const make: <Name extends string, OptionsType = void, ArgsType = void>(
  name: Name,
  options?: Options<OptionsType>,
  args?: Args<ArgsType>,
) => Command<{
  readonly args: ArgsType;
  readonly name: Name;
  readonly options: OptionsType;
}>;

prompt

Added in v1.0.0 Source

Signature

declare const prompt: <Name extends string, A>(
  name: Name,
  prompt: Prompt<A>,
) => Command<{
  readonly name: Name;
  readonly value: A;
}>;

Models

Command interface

Added in v1.0.0 Source

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

interface Command<A> extends Variance<A>, Pipeable {}

Other

Command

Added in v1.0.0 Source

Symbols

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol;

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId;