import type { EnumOption, Option } from "./index"; import type { OptionDefinition as CommandLineArgsOptionDefinition } from "command-line-args"; /** * Primary options show up in the web UI in the "Language" settings tab, * Secondary options in "Other". * CLI is only for cli */ export type OptionKind = "primary" | "secondary" | "cli"; export type OptionType = "string" | "boolean" | "enum"; export interface OptionDefinition extends CommandLineArgsOptionDefinition { /** Option Name */ name: Name; /** Option Description */ description: string; /** Category of Option */ optionType: OptionType; /** Default Value for Option */ defaultValue?: T; /** Enum only, map of possible keys and values */ values?: Record; /** Primary, Secondary, or CLI */ kind?: OptionKind; /** Whether multiple CLI inputs are allowed for this option */ multiple?: boolean; typeLabel?: string; } export type OptionName = O extends Option ? Name : never; export type OptionValue = O extends EnumOption ? EnumMap[EnumKey] : O extends Option ? Value : never; export type OptionKey = O extends EnumOption, infer EnumKey> ? EnumKey : O; export type OptionMap = { [K in keyof T as OptionName]: OptionKey; }; export type OptionValues = { [K in keyof T]: OptionValue; };