[Pkg-libvirt-commits] [libguestfs] 15/384: bash: add a completion module for virt-v2v

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:54:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 6faa7b4c844df0357f27326d88e50a3f15bbee48
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Wed Nov 26 11:28:24 2014 +0100

    bash: add a completion module for virt-v2v
---
 bash/Makefile.am |  3 ++-
 bash/virt-v2v    | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/bash/Makefile.am b/bash/Makefile.am
index ee9c10c..2c8e722 100644
--- a/bash/Makefile.am
+++ b/bash/Makefile.am
@@ -22,7 +22,8 @@ scripts = \
 	guestmount \
 	virt-alignment-scan \
 	virt-rescue \
-	virt-resize
+	virt-resize \
+	virt-v2v
 
 symlinks = \
 	virt-builder \
diff --git a/bash/virt-v2v b/bash/virt-v2v
new file mode 100644
index 0000000..cddd073
--- /dev/null
+++ b/bash/virt-v2v
@@ -0,0 +1,59 @@
+# virt-v2v bash completion script -*- shell-script -*-
+# Copyright (C) 2014 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.
+
+_virt_v2v ()
+{
+    local cur prev words cword split
+    local shortopts longopts items
+
+    _init_completion -s || return
+
+    case "$prev" in
+        -i)
+            items="$(virt-v2v --machine-readable | awk -F':' '/input:/ {print $2;}')"
+            COMPREPLY=( $( compgen -W "$items" -- "$cur") )
+            return ;;
+        -o)
+            items="$(virt-v2v --machine-readable | awk -F':' '/output:/ {print $2;}')"
+            COMPREPLY=( $( compgen -W "$items" -- "$cur") )
+            return ;;
+        -oa)
+            COMPREPLY=( $( compgen -W "sparse preallocated" -- "$cur") )
+            return ;;
+        --vmtype)
+            COMPREPLY=( $( compgen -W "server desktop" -- "$cur") )
+            return ;;
+    esac
+
+    case "$cur" in
+        --*)
+            # --options
+            longopts="$(virt-v2v --long-options)"
+            COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
+            return ;;
+        -*)
+            # -o and --options
+            shortopts="$(virt-v2v --short-options)"
+            longopts="$(virt-v2v --long-options)"
+            COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
+            return ;;
+        *)
+            COMPREPLY=( $(compgen "$cur") )
+            return ;;
+    esac
+} &&
+complete -o default -F _virt_v2v virt-v2v

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list