Skip to content
Effect Days 2026 Get your ticket

Command

24 exports Added in v1.0.0 Source

Accessors

Signature

declare const getBashCompletions: <Name extends string, R, E, A>(self: Command<Name, R, E, A>, programName: string) => Effect<Array<string>>

Signature

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

getHelp

Added in v1.0.0 Source

Signature

declare const getHelp: <Name extends string, R, E, A>(self: Command<Name, R, E, A>, config: CliConfig) => HelpDoc

getNames

Added in v1.0.0 Source

Signature

declare const getNames: <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => HashSet<string>

Signature

declare const getSubcommands: <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => HashMap<string, Descriptor.Command<unknown>>

getUsage

Added in v1.0.0 Source

Signature

declare const getUsage: <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => Usage

Signature

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

wizard

Added in v1.0.0 Source

Signature

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

Combinators

provide

Added in v1.0.0 Source

Signature

declare const provide: {
<A, LR, LE, LA>(layer: Layer<LA, LE, LR> | (_: A) => Layer<LA, LE, LR>): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, LR | Exclude<R, LA>, LE | E, A>;
<Name extends string, R, E, A, LR, LE, LA>(self: Command<Name, R, E, A>, layer: Layer<LA, LE, LR> | (_: A) => Layer<LA, LE, LR>): Command<Name, LR | Exclude<R, LA>, E | LE, A>;
}

Signature

declare const provideEffect: {
<I, S, A, R2, E2>(tag: Tag<I, S>, effect: Effect<S, E2, R2> | (_: A) => Effect<S, E2, R2>): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, R2 | Exclude<R, I>, E2 | E, A>;
<Name extends string, R, E, A, I, S, R2, E2>(self: Command<Name, R, E, A>, tag: Tag<I, S>, effect: Effect<S, E2, R2> | (_: A) => Effect<S, E2, R2>): Command<Name, R2 | Exclude<R, I>, E | E2, A>;
}

Signature

declare const provideEffectDiscard: {
<A, R2, E2, _>(effect: Effect<_, E2, R2> | (_: A) => Effect<_, E2, R2>): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, R2 | R, E2 | E, A>;
<Name extends string, R, E, A, R2, E2, _>(self: Command<Name, R, E, A>, effect: Effect<_, E2, R2> | (_: A) => Effect<_, E2, R2>): Command<Name, R | R2, E | E2, A>;
}

provideSync

Added in v1.0.0 Source

Signature

declare const provideSync: {
<I, S, A>(tag: Tag<I, S>, service: S | (_: A) => S): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, Exclude<R, I>, E, A>;
<Name extends string, R, E, A, I, S>(self: Command<Name, R, E, A>, tag: Tag<I, S>, service: S | (_: A) => S): Command<Name, Exclude<R, I>, E, A>;
}

Signature

declare const transformHandler: {
<R, E, A, R2, E2>(f: (effect: Effect<void, E, R>, config: A) => Effect<void, E2, R2>): <Name extends string>(self: Command<Name, R, E, A>) => Command<Name, R | R2, E | E2, A>;
<Name extends string, R, E, A, R2, E2>(self: Command<Name, R, E, A>, f: (effect: Effect<void, E, R>, config: A) => Effect<void, E2, R2>): Command<Name, R | R2, E | E2, A>;
}

Signature

declare const withDescription: {
(help: string | HelpDoc): <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => Command<Name, R, E, A>;
<Name extends string, R, E, A>(self: Command<Name, R, E, A>, help: string | HelpDoc): Command<Name, R, E, A>;
}

withHandler

Added in v1.0.0 Source

Signature

declare const withHandler: {
<A, R, E>(handler: (_: A) => Effect<void, E, R>): <Name extends string, XR, XE>(self: Command<Name, XR, XE, A>) => Command<Name, R, E, A>;
<Name extends string, XR, XE, A, R, E>(self: Command<Name, XR, XE, A>, handler: (_: A) => Effect<void, E, R>): Command<Name, R, E, A>;
}

Signature

declare const withSubcommands: {
<Subcommand extends readonly [Command<any, any, any, any>, Command<any, any, any, any>]>(subcommands: Subcommand): <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => Command<Name, any, any, ComputeParsedType<A & Readonly<{
subcommand: Option<Descriptor.Command.GetParsedType<...[...]["descriptor"]>>;
}>>>;
<Name extends string, R, E, A, Subcommand extends readonly [Command<any, any, any, any>, Command<any, any, any, any>]>(self: Command<Name, R, E, A>, subcommands: Subcommand): Command<Name, any, any, ComputeParsedType<A & Readonly<{
subcommand: Option<Descriptor.Command.GetParsedType<Subcommand[number]["descriptor"]>>;
}>>>;
}

Constructors

Signature

declare const fromDescriptor: {
(): <A extends {
readonly name: string;
}>(command: Command<A>) => Command<A["name"], never, never, A>;
<A extends {
readonly name: string;
}, R, E>(handler: (_: A) => Effect<void, E, R>): (command: Command<A>) => Command<A["name"], R, E, A>;
<A extends {
readonly name: string;
}>(descriptor: Command<A>): Command<A["name"], never, never, A>;
<A extends {
readonly name: string;
}, R, E>(descriptor: Command<A>, handler: (_: A) => Effect<void, E, R>): Command<A["name"], R, E, A>;
}

make

Added in v1.0.0 Source

Signature

declare const make: {
<Name extends string>(name: Name): Command<Name, never, never, {}>;
<Name extends string, Config extends Config>(name: Name, config: Config): Command<Name, never, never, Simplify<Simplify<{ [Key in string | number | symbol]: ParseConfigValue<Config[Key]> }>>>;
<Name extends string, Config extends Config, R, E>(name: Name, config: Config, handler: (_: Simplify<Simplify<{ [Key in string | number | symbol]: ParseConfigValue<Config[Key]> }>>) => Effect<void, E, R>): Command<Name, R, E, Simplify<Simplify<{ [Key in string | number | symbol]: ParseConfigValue<Config[Key]> }>>>;
}

prompt

Added in v1.0.0 Source

Signature

declare const prompt: <Name extends string, A, R, E>(name: Name, prompt: Prompt<A>, handler: (_: A) => Effect<void, E, R>) => Command<string, R, E, A>

Conversions

run

Added in v1.0.0 Source

Signature

declare const run: {
(config: Omit<CliApp.ConstructorArgs<never>, "command">): <Name extends string, R, E, A>(self: Command<Name, R, E, A>) => (args: readonly Array<string>) => Effect<void, ValidationError | E, any>;
<Name extends string, R, E, A>(self: Command<Name, R, E, A>, config: Omit<CliApp.ConstructorArgs<never>, "command">): (args: readonly Array<string>) => Effect<void, ValidationError | E, any>;
}

Models

Command

Added in v1.0.0 Source

Command interface

Added in v1.0.0 Source

Signature

interface Command<Name extends string, R, E, A> extends Pipeable, Effect<A, never, Command.Context<Name>> {
readonly [TypeId]: typeof TypeId;
readonly descriptor: Command<A>;
readonly handler: (_: A) => Effect<void, E, R>;
readonly tag: Tag<Context<Name>, A>;
readonly transform: Transform<R, E, A>;
}

Type Ids

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