Add vg-activate{,-all} commands, and resize recipe.
[libguestfs.git] / fish / completion.c
1 /* libguestfs generated file
2  * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3  * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
4  *
5  * Copyright (C) 2009 Red Hat Inc.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #include <config.h>
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27
28 #ifdef HAVE_LIBREADLINE
29 #include <readline/readline.h>
30 #endif
31
32 #include "fish.h"
33
34 #ifdef HAVE_LIBREADLINE
35
36 static const char *const commands[] = {
37   "add",
38   "add-cdrom",
39   "add-drive",
40   "append",
41   "aug-close",
42   "aug-defnode",
43   "aug-defvar",
44   "aug-get",
45   "aug-init",
46   "aug-insert",
47   "aug-load",
48   "aug-ls",
49   "aug-match",
50   "aug-mv",
51   "aug-rm",
52   "aug-save",
53   "aug-set",
54   "autosync",
55   "blockdev-flushbufs",
56   "blockdev-getbsz",
57   "blockdev-getro",
58   "blockdev-getsize64",
59   "blockdev-getss",
60   "blockdev-getsz",
61   "blockdev-rereadpt",
62   "blockdev-setbsz",
63   "blockdev-setro",
64   "blockdev-setrw",
65   "cat",
66   "cdrom",
67   "checksum",
68   "chmod",
69   "chown",
70   "command",
71   "command-lines",
72   "config",
73   "cp",
74   "cp-a",
75   "debug",
76   "dmesg",
77   "download",
78   "drop-caches",
79   "equal",
80   "exists",
81   "file",
82   "fsck",
83   "get-append",
84   "get-autosync",
85   "get-e2label",
86   "get-e2uuid",
87   "get-path",
88   "get-qemu",
89   "get-state",
90   "get-verbose",
91   "grub-install",
92   "hexdump",
93   "is-busy",
94   "is-config",
95   "is-dir",
96   "is-file",
97   "is-launching",
98   "is-ready",
99   "kill-subprocess",
100   "launch",
101   "list-devices",
102   "list-partitions",
103   "ll",
104   "ls",
105   "lstat",
106   "lvcreate",
107   "lvm-remove-all",
108   "lvremove",
109   "lvs",
110   "lvs-full",
111   "mkdir",
112   "mkdir-p",
113   "mkfs",
114   "mount",
115   "mount-options",
116   "mount-ro",
117   "mount-vfs",
118   "mounts",
119   "mv",
120   "path",
121   "ping-daemon",
122   "pvcreate",
123   "pvremove",
124   "pvresize",
125   "pvs",
126   "pvs-full",
127   "qemu",
128   "read-lines",
129   "rm",
130   "rm-rf",
131   "rmdir",
132   "run",
133   "set-append",
134   "set-autosync",
135   "set-e2label",
136   "set-e2uuid",
137   "set-path",
138   "set-qemu",
139   "set-verbose",
140   "sfdisk",
141   "sfdisk-N",
142   "sfdisk-disk-geometry",
143   "sfdisk-kernel-geometry",
144   "sfdisk-l",
145   "stat",
146   "statvfs",
147   "strings",
148   "strings-e",
149   "sync",
150   "tar-in",
151   "tar-out",
152   "tgz-in",
153   "tgz-out",
154   "touch",
155   "tune2fs-l",
156   "umount",
157   "umount-all",
158   "unmount",
159   "unmount-all",
160   "upload",
161   "verbose",
162   "vg-activate",
163   "vg-activate-all",
164   "vgcreate",
165   "vgremove",
166   "vgs",
167   "vgs-full",
168   "write-file",
169   "zero",
170   "zerofree",
171   NULL
172 };
173
174 static char *
175 generator (const char *text, int state)
176 {
177   static int index, len;
178   const char *name;
179
180   if (!state) {
181     index = 0;
182     len = strlen (text);
183   }
184
185   while ((name = commands[index]) != NULL) {
186     index++;
187     if (strncasecmp (name, text, len) == 0)
188       return strdup (name);
189   }
190
191   return NULL;
192 }
193
194 #endif /* HAVE_LIBREADLINE */
195
196 char **do_completion (const char *text, int start, int end)
197 {
198   char **matches = NULL;
199
200 #ifdef HAVE_LIBREADLINE
201   if (start == 0)
202     matches = rl_completion_matches (text, generator);
203 #endif
204
205   return matches;
206 }