• 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: "top level subcommand",
31      subcommands: [
32        {
33          name: "sub_cmd",
34          description: "sub-subcommand",
35          options: [
36            {
37              name: "--config",
38              description: "the other case to test",
39              isRepeatable: true,
40              args: {
41                name: "config",
42                isOptional: true,
43                suggestions: [
44                  "Lest quotes aren't escaped.",
45                ],
46              },
47            },
48            {
49              name: ["-h", "--help"],
50              description: "Print help",
51            },
52            {
53              name: ["-V", "--version"],
54              description: "Print version",
55            },
56          ],
57        },
58        {
59          name: "help",
60          description: "Print this message or the help of the given subcommand(s)",
61          subcommands: [
62            {
63              name: "sub_cmd",
64              description: "sub-subcommand",
65            },
66            {
67              name: "help",
68              description: "Print this message or the help of the given subcommand(s)",
69            },
70          ],
71        },
72      ],
73      options: [
74        {
75          name: ["-h", "--help"],
76          description: "Print help",
77        },
78        {
79          name: ["-V", "--version"],
80          description: "Print version",
81        },
82      ],
83    },
84    {
85      name: "help",
86      description: "Print this message or the help of the given subcommand(s)",
87      subcommands: [
88        {
89          name: "test",
90          description: "tests things",
91        },
92        {
93          name: "some_cmd",
94          description: "top level subcommand",
95          subcommands: [
96            {
97              name: "sub_cmd",
98              description: "sub-subcommand",
99            },
100          ],
101        },
102        {
103          name: "help",
104          description: "Print this message or the help of the given subcommand(s)",
105        },
106      ],
107    },
108  ],
109  options: [
110    {
111      name: ["-c", "-C", "--config", "--conf"],
112      description: "some config file",
113      isRepeatable: true,
114    },
115    {
116      name: ["-h", "--help"],
117      description: "Print help",
118    },
119    {
120      name: ["-V", "--version"],
121      description: "Print version",
122    },
123  ],
124  args: [
125    {
126      name: "file",
127      isOptional: true,
128      template: "filepaths",
129    },
130    {
131      name: "choice",
132      isOptional: true,
133      suggestions: [
134        "first",
135        "second",
136      ],
137    },
138  ]
139};
140
141export default completion;
142