X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Fcompletion.c;fp=fish%2Fcompletion.c;h=0000000000000000000000000000000000000000;hb=b3cb0b04eb2d38ba32c160a83d8e3894b376907b;hp=b506559b9fa35ff9953a82235463b250bce348b8;hpb=da85ed425dc828ef4b8817f64d448101a88507b5;p=libguestfs.git diff --git a/fish/completion.c b/fish/completion.c deleted file mode 100644 index b506559..0000000 --- a/fish/completion.c +++ /dev/null @@ -1,252 +0,0 @@ -/* libguestfs generated file - * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'. - * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST. - * - * Copyright (C) 2009 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include - -#include -#include -#include - -#ifdef HAVE_LIBREADLINE -#include -#endif - -#include "fish.h" - -#ifdef HAVE_LIBREADLINE - -static const char *const commands[] = { - BUILTIN_COMMANDS_FOR_COMPLETION, - "launch", - "run", - "kill-subprocess", - "add-drive", - "add", - "add-cdrom", - "cdrom", - "add-drive-ro", - "add-ro", - "config", - "set-qemu", - "qemu", - "get-qemu", - "set-path", - "path", - "get-path", - "set-append", - "append", - "get-append", - "set-autosync", - "autosync", - "get-autosync", - "set-verbose", - "verbose", - "get-verbose", - "is-ready", - "is-config", - "is-launching", - "is-busy", - "get-state", - "set-memsize", - "memsize", - "get-memsize", - "mount", - "sync", - "touch", - "cat", - "ll", - "ls", - "list-devices", - "list-partitions", - "pvs", - "vgs", - "lvs", - "pvs-full", - "vgs-full", - "lvs-full", - "read-lines", - "aug-init", - "aug-close", - "aug-defvar", - "aug-defnode", - "aug-get", - "aug-set", - "aug-insert", - "aug-rm", - "aug-mv", - "aug-match", - "aug-save", - "aug-load", - "aug-ls", - "rm", - "rmdir", - "rm-rf", - "mkdir", - "mkdir-p", - "chmod", - "chown", - "exists", - "is-file", - "is-dir", - "pvcreate", - "vgcreate", - "lvcreate", - "mkfs", - "sfdisk", - "write-file", - "umount", - "unmount", - "mounts", - "umount-all", - "unmount-all", - "lvm-remove-all", - "file", - "command", - "command-lines", - "stat", - "lstat", - "statvfs", - "tune2fs-l", - "blockdev-setro", - "blockdev-setrw", - "blockdev-getro", - "blockdev-getss", - "blockdev-getbsz", - "blockdev-setbsz", - "blockdev-getsz", - "blockdev-getsize64", - "blockdev-flushbufs", - "blockdev-rereadpt", - "upload", - "download", - "checksum", - "tar-in", - "tar-out", - "tgz-in", - "tgz-out", - "mount-ro", - "mount-options", - "mount-vfs", - "debug", - "lvremove", - "vgremove", - "pvremove", - "set-e2label", - "get-e2label", - "set-e2uuid", - "get-e2uuid", - "fsck", - "zero", - "grub-install", - "cp", - "cp-a", - "mv", - "drop-caches", - "dmesg", - "ping-daemon", - "equal", - "strings", - "strings-e", - "hexdump", - "zerofree", - "pvresize", - "sfdisk-N", - "sfdisk-l", - "sfdisk-kernel-geometry", - "sfdisk-disk-geometry", - "vg-activate-all", - "vg-activate", - "lvresize", - "resize2fs", - "find", - "e2fsck-f", - "sleep", - "ntfs-3g-probe", - "sh", - "sh-lines", - "glob-expand", - "scrub-device", - "scrub-file", - "scrub-freespace", - "mkdtemp", - "wc-l", - "wc-w", - "wc-c", - "head", - "head-n", - "tail", - "tail-n", - "df", - "df-h", - "du", - "initrd-list", - "mount-loop", - "mkswap", - "mkswap-L", - "mkswap-U", - "mknod", - "mkfifo", - "mknod-b", - "mknod-c", - "umask", - "readdir", - NULL -}; - -static char * -generator (const char *text, int state) -{ - static int index, len; - const char *name; - - if (!state) { - index = 0; - len = strlen (text); - } - - rl_attempted_completion_over = 1; - - while ((name = commands[index]) != NULL) { - index++; - if (strncasecmp (name, text, len) == 0) - return strdup (name); - } - - return NULL; -} - -#endif /* HAVE_LIBREADLINE */ - -char **do_completion (const char *text, int start, int end) -{ - char **matches = NULL; - -#ifdef HAVE_LIBREADLINE - rl_completion_append_character = ' '; - - if (start == 0) - matches = rl_completion_matches (text, generator); - else if (complete_dest_paths) - matches = rl_completion_matches (text, complete_dest_paths_generator); -#endif - - return matches; -}