Implement lvremove, vgremove, pvremove.
[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 *commands[] = {
37   "add",
38   "add-cdrom",
39   "add-drive",
40   "aug-close",
41   "aug-defnode",
42   "aug-defvar",
43   "aug-get",
44   "aug-init",
45   "aug-insert",
46   "aug-load",
47   "aug-ls",
48   "aug-match",
49   "aug-mv",
50   "aug-rm",
51   "aug-save",
52   "aug-set",
53   "autosync",
54   "blockdev-flushbufs",
55   "blockdev-getbsz",
56   "blockdev-getro",
57   "blockdev-getsize64",
58   "blockdev-getss",
59   "blockdev-getsz",
60   "blockdev-rereadpt",
61   "blockdev-setbsz",
62   "blockdev-setro",
63   "blockdev-setrw",
64   "cat",
65   "cdrom",
66   "checksum",
67   "chmod",
68   "chown",
69   "command",
70   "command-lines",
71   "config",
72   "debug",
73   "download",
74   "exists",
75   "file",
76   "get-autosync",
77   "get-path",
78   "get-qemu",
79   "get-state",
80   "get-verbose",
81   "is-busy",
82   "is-config",
83   "is-dir",
84   "is-file",
85   "is-launching",
86   "is-ready",
87   "kill-subprocess",
88   "launch",
89   "list-devices",
90   "list-partitions",
91   "ll",
92   "ls",
93   "lstat",
94   "lvcreate",
95   "lvm-remove-all",
96   "lvs",
97   "lvs-full",
98   "mkdir",
99   "mkdir-p",
100   "mkfs",
101   "mount",
102   "mount-options",
103   "mount-ro",
104   "mount-vfs",
105   "mounts",
106   "path",
107   "pvcreate",
108   "pvs",
109   "pvs-full",
110   "qemu",
111   "read-lines",
112   "rm",
113   "rm-rf",
114   "rmdir",
115   "run",
116   "set-autosync",
117   "set-path",
118   "set-qemu",
119   "set-verbose",
120   "sfdisk",
121   "stat",
122   "statvfs",
123   "sync",
124   "tar-in",
125   "tar-out",
126   "tgz-in",
127   "tgz-out",
128   "touch",
129   "tune2fs-l",
130   "umount",
131   "umount-all",
132   "unmount",
133   "unmount-all",
134   "upload",
135   "verbose",
136   "vgcreate",
137   "vgs",
138   "vgs-full",
139   "write-file",
140   NULL
141 };
142
143 static char *
144 generator (const char *text, int state)
145 {
146   static int index, len;
147   const char *name;
148
149   if (!state) {
150     index = 0;
151     len = strlen (text);
152   }
153
154   while ((name = commands[index]) != NULL) {
155     index++;
156     if (strncasecmp (name, text, len) == 0)
157       return strdup (name);
158   }
159
160   return NULL;
161 }
162
163 #endif /* HAVE_LIBREADLINE */
164
165 char **do_completion (const char *text, int start, int end)
166 {
167   char **matches = NULL;
168
169 #ifdef HAVE_LIBREADLINE
170   if (start == 0)
171     matches = rl_completion_matches (text, generator);
172 #endif
173
174   return matches;
175 }