aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2013-11-14 11:54:18 +0100
committerKevin Wolf <kwolf@redhat.com>2014-01-22 12:07:17 +0100
commit4694020d3c0d21f02408d5cc6f44b8fb55b4ee15 (patch)
tree9e54963e262d2c6f177733db222a34496eb94c49 /qemu-io.c
parent0cf17e181798063c3824c8200ba46f25f54faa1a (diff)
qemu-io: add command completion
Autocomplete qemu-io commands at the interactive prompt. Note this only completes command names and not their options. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/qemu-io.c b/qemu-io.c
index d7c26d3ed0..fdc46a97e8 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -236,9 +236,15 @@ static void readline_func(void *opaque, const char *str, void *readline_opaque)
*line = g_strdup(str);
}
+static void completion_match(const char *cmd, void *opaque)
+{
+ readline_add_completion(readline_state, cmd);
+}
+
static void readline_completion_func(void *opaque, const char *str)
{
- /* No command or argument completion implemented yet */
+ readline_set_completion_index(readline_state, strlen(str));
+ qemuio_complete_command(str, completion_match, NULL);
}
static char *fetchline_readline(void)