[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xl: Add basic bash completion for xl command.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1272970090 -3600 # Node ID 4cfcd77b0668a2140ab0c7e8dab56d82126caedd # Parent 0bc3fee02a5c312e02d46cd7e0c9d22a1f949eb0 xl: Add basic bash completion for xl command. Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx> --- Config.mk | 1 + tools/libxl/Makefile | 1 + tools/libxl/bash-completion | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) diff -r 0bc3fee02a5c -r 4cfcd77b0668 Config.mk --- a/Config.mk Tue May 04 11:46:24 2010 +0100 +++ b/Config.mk Tue May 04 11:48:10 2010 +0100 @@ -29,6 +29,7 @@ SHAREDIR ?= $(PREFIX)/share SHAREDIR ?= $(PREFIX)/share DOCDIR ?= $(SHAREDIR)/doc/xen MANDIR ?= $(SHAREDIR)/man +BASH_COMPLETION_DIR ?= /etc/profile.d ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include diff -r 0bc3fee02a5c -r 4cfcd77b0668 tools/libxl/Makefile --- a/tools/libxl/Makefile Tue May 04 11:46:24 2010 +0100 +++ b/tools/libxl/Makefile Tue May 04 11:48:10 2010 +0100 @@ -100,6 +100,7 @@ install: all ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR) $(INSTALL_DATA) libxl.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DATA) bash-completion $(BASH_COMPLETION_DIR)/xl.sh .PHONY: clean clean: diff -r 0bc3fee02a5c -r 4cfcd77b0668 tools/libxl/bash-completion --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxl/bash-completion Tue May 04 11:48:10 2010 +0100 @@ -0,0 +1,21 @@ +#!/bin/bash +# Copy this file to /etc/profile.d/xl.sh + +_xl() +{ + local IFS=$'\n,' + + local cur opts xl + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + xl=xl + + if [[ $COMP_CWORD == 1 ]] ; then + opts=`${xl} help 2>/dev/null | sed 'n;d' | sed '1,2d' | awk '{print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + return 0 +} + +complete -F _xl -o nospace -o default xl _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |