import { Argument, Flag } from "effect/unstable/cli";
import type { FlagDescriptor } from "./descriptors.js";
import { descriptors, specsDescriptor } from "./descriptors.js";
/** The description, alias and metavar every flag shares. */
const common =
(descriptor: FlagDescriptor) =>
(flag: Flag.Flag): Flag.Flag => {
let out = Flag.withDescription(flag, descriptor.description);
if (descriptor.alias !== undefined) out = Flag.withAlias(out, descriptor.alias);
if (descriptor.metavar !== undefined) out = Flag.withMetavar(out, descriptor.metavar);
return out;
};
type Descriptor = FlagDescriptor & {
readonly type: Extract;
};
// One builder per shape, not one generic builder, because the types are the
// point: `Command.make` derives the handler's argument from the exact type of
// each `Flag`, so `Flag` and `Flag