• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const completion: Fig.Spec = {
2  name: "my-app",
3  description: "Tests completions",
4  subcommands: [
5    {
6      name: "test",
7      description: "tests things",
8      options: [
9        {
10          name: "--case",
11          description: "the case to test",
12          isRepeatable: true,
13          args: {
14            name: "case",
15            isOptional: true,
16          },
17        },
18        {
19          name: ["-h", "--help"],
20          description: "Print help",
21        },
22        {
23          name: ["-V", "--version"],
24          description: "Print version",
25        },
26      ],
27    },
28    {
29      name: "some_cmd",
30      description: "tests other things",
31      options: [
32        {
33          name: "--config",
34          description: "the other case to test",
35          hidden: true,
36          isRepeatable: true,
37          requiresEquals: true,
38          args: {
39            name: "config",
40            isOptional: true,
41          },
42        },
43        {
44          name: ["-h", "--help"],
45          description: "Print help",
46        },
47        {
48          name: ["-V", "--version"],
49          description: "Print version",
50        },
51      ],
52      args: {
53        name: "path",
54        isVariadic: true,
55        isOptional: true,
56      },
57    },
58    {
59      name: ["some-cmd-with-hyphens", "hyphen"],
60      options: [
61        {
62          name: ["-h", "--help"],
63          description: "Print help",
64        },
65        {
66          name: ["-V", "--version"],
67          description: "Print version",
68        },
69      ],
70    },
71    {
72      name: "some-hidden-cmd",
73      hidden: true,
74      options: [
75        {
76          name: ["-h", "--help"],
77          description: "Print help",
78        },
79        {
80          name: ["-V", "--version"],
81          description: "Print version",
82        },
83      ],
84    },
85    {
86      name: "help",
87      description: "Print this message or the help of the given subcommand(s)",
88      subcommands: [
89        {
90          name: "test",
91          description: "tests things",
92        },
93        {
94          name: "some_cmd",
95          description: "tests other things",
96        },
97        {
98          name: "some-cmd-with-hyphens",
99        },
100        {
101          name: "some-hidden-cmd",
102          hidden: true,
103        },
104        {
105          name: "help",
106          description: "Print this message or the help of the given subcommand(s)",
107        },
108      ],
109    },
110  ],
111  options: [
112    {
113      name: ["-c", "-C", "--config", "--conf"],
114      description: "some config file",
115      isRepeatable: true,
116    },
117    {
118      name: ["-h", "--help"],
119      description: "Print help",
120    },
121    {
122      name: ["-V", "--version"],
123      description: "Print version",
124    },
125  ],
126  args: [
127    {
128      name: "file",
129      isOptional: true,
130      template: "filepaths",
131    },
132    {
133      name: "choice",
134      isOptional: true,
135      suggestions: [
136        "first",
137        "second",
138      ],
139    },
140  ]
141};
142
143export default completion;
144