Skip to content

Primitive

16 exports Added in v1.0.0 Source

Combinators

getChoices

Added in v1.0.0 Source

Returns a text representation of the valid choices for a primitive type, if any.

Signature

declare const getChoices: <A>(self: Primitive<A>) => Option<string>;

getHelp

Added in v1.0.0 Source

Returns help documentation for a primitive type.

Signature

declare const getHelp: <A>(self: Primitive<A>) => Span;

getTypeName

Added in v1.0.0 Source

Returns a string representation of the primitive type.

Signature

declare const getTypeName: <A>(self: Primitive<A>) => string;

validate

Added in v1.0.0 Source

Validates that the specified value, if any, matches the specified primitive type.

Signature

declare const validate: {
  (
    value: Option<string>,
    config: CliConfig,
  ): <A>(self: Primitive<A>) => Effect<A, string, FileSystem>;
  <A>(self: Primitive<A>, value: Option<string>, config: CliConfig): Effect<A, string, FileSystem>;
};

wizard

Added in v1.0.0 Source

Runs a wizard that will prompt the user for input matching the specified primitive type.

Signature

declare const wizard: {
  (help: HelpDoc): <A>(self: Primitive<A>) => Prompt<A>;
  <A>(self: Primitive<A>, help: HelpDoc): Prompt<A>;
};

Constructors

boolean

Added in v1.0.0 Source

Represents a boolean value.

True values can be passed as one of: ["true", "1", "y", "yes" or "on"]. False value can be passed as one of: ["false", "o", "n", "no" or "off"].

Signature

declare const boolean: (defaultValue: Option<boolean>) => Primitive<boolean>;

choice

Added in v1.0.0 Source

Signature

declare const choice: <A>(alternatives: ReadonlyArray<[string, A]>) => Primitive<A>;

date

Added in v1.0.0 Source

Represents a date in ISO-8601 format, such as 2007-12-03T10:15:30.

Signature

declare const date: Primitive<globalThis.Date>;

float

Added in v1.0.0 Source

Represents a floating point number.

Signature

declare const float: Primitive<number>;

integer

Added in v1.0.0 Source

Represents an integer.

Signature

declare const integer: Primitive<number>;

text

Added in v1.0.0 Source

Represents a user-defined piece of text.

Signature

declare const text: Primitive<string>;

Models

Primitive interface

Added in v1.0.0 Source

A Primitive represents the primitive types supported by Effect CLI.

Each primitive type has a way to parse and validate from a string.

Signature

interface Primitive<A> extends Variance<A> {}

Other

Primitive

Added in v1.0.0 Source

Predicates

isBool

Added in v1.0.0 Source

Signature

declare const isBool: <A>(self: Primitive<A>) => boolean;

Symbol

Signature

declare const PrimitiveTypeId: unique symbol;

PrimitiveTypeId type

Added in v1.0.0 Source

Signature

type PrimitiveTypeId = typeof PrimitiveTypeId;