X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Fcompletion.c;h=e8d8cea5b9cdbfabf5670e43655987126ccc7089;hp=7b4f818a8ce6bc0282373ec3fbbf346ccac523ca;hb=ad8a256f54a6cb99f89bb444c8597a152a793dce;hpb=6bcbe54b5785cb8c911ccf4b724ae6abfdf53ce4 diff --git a/fish/completion.c b/fish/completion.c index 7b4f818..e8d8cea 100644 --- a/fish/completion.c +++ b/fish/completion.c @@ -33,80 +33,153 @@ #ifdef HAVE_LIBREADLINE -static const char *commands[] = { +static const char *const commands[] = { + BUILTIN_COMMANDS_FOR_COMPLETION, + "launch", + "run", + "kill-subprocess", + "add-drive", "add", "add-cdrom", - "add-drive", + "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", + "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-defnode", "aug-defvar", + "aug-defnode", "aug-get", - "aug-init", + "aug-set", "aug-insert", - "aug-load", - "aug-ls", - "aug-match", - "aug-mv", "aug-rm", + "aug-mv", + "aug-match", "aug-save", - "aug-set", - "autosync", - "cat", - "cdrom", + "aug-load", + "aug-ls", + "rm", + "rmdir", + "rm-rf", + "mkdir", + "mkdir-p", "chmod", "chown", - "command", - "command-lines", - "config", "exists", - "file", - "get-autosync", - "get-path", - "get-verbose", - "is-dir", "is-file", - "kill-subprocess", - "launch", - "list-devices", - "list-partitions", - "ll", - "ls", - "lstat", + "is-dir", + "pvcreate", + "vgcreate", "lvcreate", - "lvm-remove-all", - "lvs", - "lvs-full", - "mkdir", - "mkdir-p", "mkfs", - "mount", - "mounts", - "path", - "pvcreate", - "pvs", - "pvs-full", - "read-lines", - "rm", - "rm-rf", - "rmdir", - "run", - "set-autosync", - "set-path", - "set-verbose", "sfdisk", - "stat", - "statvfs", - "sync", - "touch", + "write-file", "umount", - "umount-all", "unmount", + "mounts", + "umount-all", "unmount-all", - "verbose", - "vgcreate", - "vgs", - "vgs-full", - "write-file", + "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", NULL }; @@ -121,6 +194,8 @@ generator (const char *text, int state) len = strlen (text); } + rl_attempted_completion_over = 1; + while ((name = commands[index]) != NULL) { index++; if (strncasecmp (name, text, len) == 0) @@ -137,8 +212,12 @@ 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;