Primitive overview
Added in v1.0.0
Table of contents
Predicates
isBool
Signature
export declare const isBool: <A>(self: Primitive<A>) => boolean
Added in v1.0.0
combinators
getChoices
Returns a text representation of the valid choices for a primitive type, if any.
Signature
export declare const getChoices: <A>(self: Primitive<A>) => Option<string>
Added in v1.0.0
getHelp
Returns help documentation for a primitive type.
Signature
export declare const getHelp: <A>(self: Primitive<A>) => Span
Added in v1.0.0
getTypeName
Returns a string representation of the primitive type.
Signature
export declare const getTypeName: <A>(self: Primitive<A>) => string
Added in v1.0.0
validate
Validates that the specified value, if any, matches the specified primitive type.
Signature
export 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>
}
Added in v1.0.0
wizard
Runs a wizard that will prompt the user for input matching the specified primitive type.
Signature
export declare const wizard: {
(help: HelpDoc): <A>(self: Primitive<A>) => Prompt<A>
<A>(self: Primitive<A>, help: HelpDoc): Prompt<A>
}
Added in v1.0.0
constructors
boolean
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
export declare const boolean: (defaultValue: Option<boolean>) => Primitive<boolean>
Added in v1.0.0
choice
Signature
export declare const choice: <A>(alternatives: ReadonlyArray<[string, A]>) => Primitive<A>
Added in v1.0.0
date
Represents a date in ISO-8601 format, such as 2007-12-03T10:15:30
.
Signature
export declare const date: Primitive<Date>
Added in v1.0.0
float
Represents a floating point number.
Signature
export declare const float: Primitive<number>
Added in v1.0.0
integer
Represents an integer.
Signature
export declare const integer: Primitive<number>
Added in v1.0.0
text
Represents a user-defined piece of text.
Signature
export declare const text: Primitive<string>
Added in v1.0.0
models
Primitive (interface)
A Primitive
represents the primitive types supported by Effect CLI.
Each primitive type has a way to parse and validate from a string.
Signature
export interface Primitive<A> extends Primitive.Variance<A> {}
Added in v1.0.0
symbol
PrimitiveTypeId
Signature
export declare const PrimitiveTypeId: typeof PrimitiveTypeId
Added in v1.0.0
PrimitiveTypeId (type alias)
Signature
export type PrimitiveTypeId = typeof PrimitiveTypeId
Added in v1.0.0
utils
Primitive (namespace)
Added in v1.0.0
Variance (interface)
Signature
export interface Variance<A> extends Pipeable {
readonly [PrimitiveTypeId]: {
readonly _A: (_: never) => A
}
}
Added in v1.0.0
PathExists (type alias)
Signature
export type PathExists = "yes" | "no" | "either"
Added in v1.0.0
PathType (type alias)
Signature
export type PathType = "file" | "directory" | "either"
Added in v1.0.0
ValueType (type alias)
Signature
export type ValueType<P> = [P] extends [
{
readonly [PrimitiveTypeId]: {
readonly _A: (_: never) => infer A
}
}
]
? A
: never
Added in v1.0.0