From 52bf853cee09265ce914ea6048d4068dc99339bc Mon Sep 17 00:00:00 2001 From: Thomas Reifenberger Date: Fri, 13 Oct 2017 12:59:01 +0200 Subject: [PATCH] Add completion for snapshot names for vagrant snapshot restore|delete - Note that this does not cover additional options like --no-provision - It is also a bit slow, as `vagrant snapshot list` is used to gather the data --- contrib/bash/completion.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/bash/completion.sh b/contrib/bash/completion.sh index c25f31aaa..2c01de60e 100644 --- a/contrib/bash/completion.sh +++ b/contrib/bash/completion.sh @@ -140,6 +140,15 @@ _vagrant() { ;; esac ;; + "snapshot") + case "$prev" in + "restore"|"delete") + local snapshot_list=$(vagrant snapshot list) + COMPREPLY=($(compgen -W "${snapshot_list}" -- ${cur})) + return 0 + ;; + esac + ;; *) ;; esac