File size: 2,666 Bytes
31e8457
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
 * Shell type used to generate completion scripts.
 *
 * @category models
 * @since 4.0.0
 */
export type Shell = "bash" | "zsh" | "fish";
/**
 * Describes a command for completion script generation.
 *
 * @category models
 * @since 4.0.0
 */
export interface CommandDescriptor {
    readonly name: string;
    readonly description: string | undefined;
    readonly flags: ReadonlyArray<FlagDescriptor>;
    readonly arguments: ReadonlyArray<ArgumentDescriptor>;
    readonly subcommands: ReadonlyArray<CommandDescriptor>;
}
/**
 * Describes a command flag for completions.
 *
 * @category models
 * @since 4.0.0
 */
export interface FlagDescriptor {
    readonly name: string;
    readonly aliases: ReadonlyArray<string>;
    readonly description: string | undefined;
    readonly type: FlagType;
}
/**
 * Describes the supported flag value shapes.
 *
 * @category models
 * @since 4.0.0
 */
export type FlagType = {
    readonly _tag: "Boolean";
} | {
    readonly _tag: "String";
} | {
    readonly _tag: "Integer";
} | {
    readonly _tag: "Float";
} | {
    readonly _tag: "Date";
} | {
    readonly _tag: "Choice";
    readonly values: ReadonlyArray<string>;
} | {
    readonly _tag: "Path";
    readonly pathType: "file" | "directory" | "either";
};
/**
 * Describes a positional argument for completions.
 *
 * @category models
 * @since 4.0.0
 */
export interface ArgumentDescriptor {
    readonly name: string;
    readonly description: string | undefined;
    readonly required: boolean;
    readonly variadic: boolean;
    readonly type: ArgumentType;
}
/**
 * Describes the supported argument value shapes.
 *
 * @category models
 * @since 4.0.0
 */
export type ArgumentType = {
    readonly _tag: "String";
} | {
    readonly _tag: "Integer";
} | {
    readonly _tag: "Float";
} | {
    readonly _tag: "Date";
} | {
    readonly _tag: "Choice";
    readonly values: ReadonlyArray<string>;
} | {
    readonly _tag: "Path";
    readonly pathType: "file" | "directory" | "either";
};
/**
 * Generates a shell completion script for a command descriptor.
 *
 * **When to use**
 *
 * Use when you need an installable completion script from an existing
 * `CommandDescriptor`.
 *
 * **Details**
 *
 * Dispatches by `shell` to Bash, Zsh, or Fish generation and returns a static
 * script string for `executableName`.
 *
 * @see {@link Shell} for supported shell names
 * @see {@link CommandDescriptor} for the command shape used by completion generation
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const generate: (executableName: string, shell: Shell, descriptor: CommandDescriptor) => string;
//# sourceMappingURL=Completions.d.ts.map