File size: 1,326 Bytes
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
/**
 * The `Completions` module turns a plain description of an Effect CLI command
 * tree into shell completion scripts for Bash, Zsh, and Fish. It is the
 * low-level script generation surface used by the unstable CLI package and by
 * the built-in completions global flag.
 *
 * @since 4.0.0
 */
import * as Bash from "./internal/completions/bash.js";
import * as Fish from "./internal/completions/fish.js";
import * as Zsh from "./internal/completions/zsh.js";
/**
 * 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 const generate = (executableName, shell, descriptor) => {
  switch (shell) {
    case "bash":
      return Bash.generate(executableName, descriptor);
    case "zsh":
      return Zsh.generate(executableName, descriptor);
    case "fish":
      return Fish.generate(executableName, descriptor);
  }
};
//# sourceMappingURL=Completions.js.map