import { SfdxCommand } from './sfdxCommand'; /** * DocOpts generator for SfdxCommands. See http://docopt.org/. * * flag.exclusive: groups elements when one of the mutually exclusive cases is a required flag: (--apple | --orange) * flag.exclusive: groups elements when none of the mutually exclusive cases is required (optional flags): [--apple | --orange] * flag.dependsOn: specifies that if one element is present, then another one is required: (--apple --orange) * cmd.variableArgs: produces 'name=value' * * @example * { * name: 'classnames', * required: true, * exclusive: ['suitenames'] * ... * },{ * name: 'suitenames', * type: 'array' * required: true * ... * } * * Results in: * Usage: <%= command.id %> (-n | -s ) * * @example * { * name: 'classnames', * ... * excludes: ['suitenames'] * },{ * name: 'suitenames', * ... * } * * Results in: * Usage: <%= command.id %> [-n | -s ] * * @example * { * name: 'classnames', * ... * dependsOn: ['suitenames'] * },{ * name: 'suitenames', * type: 'flag' * ... * } * * Results in: * Usage: <%= command.id %> (-n -s) * * TODO: * - Support nesting, eg: * Usage: my_program (--either-this | ) * Usage: my_program [( )] * * @param cmdDef */ export declare class DocOpts { private cmd; private flags; private flagList; constructor(cmd: T); static generate(cmdDef: T): string; toString(): string; /** * Group flags that dependOn (and) and are exclusive (or). */ private groupFlagElements; /** * Combine doc opt elements to another flag's doc opt element. This is for supporting * things like "and" (dependsOn) and "or" (exclusive). * * This will probably break down on complex dependsOn / exclusive flag structures. * For example, a flag that depends on a flag that depends on another flag. * * See tests to see what is supported. * * @param elementMap All doc opt elements. * @param flagName The name of the flag to combine to. * @param flagNames The other flag names to combine to flagName. * @param unionString How to combine the doc opt elements. */ private combineElementsToFlag; /** * Categorize flags into required, optional, builtin opt-in, and mandatory builtin * flags. This is the order they should appear in the doc opts. * * For example, flags defined on the actual command should some before standard * fields like --json. */ private categorizeFlags; /** * Generate doc opt elements for all flags. * * @param elementMap The map to add the elements to. * @param flagGroups The flags to generate elements for. */ private generateElements; }