Thanks to visit codestin.com
Credit goes to effect-ts.github.io

Skip to main content Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

Command.ts overview

Since v1.0.0


Exports Grouped by Category


accessors

getBashCompletions

Signature

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

Source

Since v1.0.0

getFishCompletions

Signature

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

Source

Since v1.0.0

getHelp

Signature

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

Source

Since v1.0.0

getNames

Signature

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

Source

Since v1.0.0

getSubcommands

Signature

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

Source

Since v1.0.0

getUsage

Signature

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

Source

Since v1.0.0

getZshCompletions

Signature

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

Source

Since v1.0.0

wizard

Signature

declare const wizard: {
  (
    prefix: ReadonlyArray<string>,
    config: CliConfig
  ): <Name extends string, R, E, A>(
    self: Command<Name, R, E, A>
  ) => Effect<Array<string>, QuitException | ValidationError, FileSystem | Path | Terminal>
  <Name extends string, R, E, A>(
    self: Command<Name, R, E, A>,
    prefix: ReadonlyArray<string>,
    config: CliConfig
  ): Effect<Array<string>, QuitException | ValidationError, FileSystem | Path | Terminal>
}

Source

Since v1.0.0

combinators

provide

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

Source

Since v1.0.0

provideEffect

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

Source

Since v1.0.0

provideEffectDiscard

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

Source

Since v1.0.0

provideSync

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

Source

Since v1.0.0

transformHandler

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

Source

Since v1.0.0

withDescription

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

Source

Since v1.0.0

withHandler

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

Source

Since v1.0.0

withSubcommands

Signature

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

Source

Since v1.0.0

constructors

fromDescriptor

Signature

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

Source

Since v1.0.0

make

Signature

declare const make: {
  <Name extends string>(name: Name): Command<Name, never, never, {}>
  <Name extends string, const Config extends Command.Config>(
    name: Name,
    config: Config
  ): Command<Name, never, never, Types.Simplify<Command.ParseConfig<Config>>>
  <Name extends string, const Config extends Command.Config, R, E>(
    name: Name,
    config: Config,
    handler: (_: Types.Simplify<Command.ParseConfig<Config>>) => Effect<void, E, R>
  ): Command<Name, R, E, Types.Simplify<Command.ParseConfig<Config>>>
}

Source

Since v1.0.0

prompt

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>

Source

Since v1.0.0

conversions

run

Signature

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

Source

Since v1.0.0

models

Command (interface)

Signature

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

Source

Since v1.0.0

Command (namespace)

Source

Since v1.0.0

Context (interface)

Signature

export interface Context<Name extends string> {
  readonly _: unique symbol
  readonly name: Name
}

Source

Since v1.0.0

Config (interface)

Signature

export interface Config {
  readonly [key: string]: Args<any> | Options<any> | ReadonlyArray<Args<any> | Options<any> | Config> | Config
}

Source

Since v1.0.0

ParsedConfig (interface)

Signature

export interface ParsedConfig {
  readonly args: ReadonlyArray<Args<any>>
  readonly options: ReadonlyArray<Options<any>>
  readonly tree: ParsedConfigTree
}

Source

Since v1.0.0

ParseConfig (type alias)

Signature

type ParseConfig<A> = Types.Simplify<{ readonly [Key in keyof A]: ParseConfigValue<A[Key]> }>

Source

Since v1.0.0

Transform (type alias)

Signature

type Transform<R, E, A> = (effect: Effect<void, any, any>, config: A) => Effect<void, E, R>

Source

Since v1.0.0

type ids

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