xl: Add basic bash completion for xl command.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2010-05-04 11:48:10 +01:00
1 parent 817ad21add
commit 9136a919b1
3 files changed
+23

No files matched your search

+1
View File
@@ -29,6 +29,7 @@ include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
SHAREDIR ?= $(PREFIX)/share
DOCDIR ?= $(SHAREDIR)/doc/xen
MANDIR ?= $(SHAREDIR)/man
BASH_COMPLETION_DIR ?= /etc/profile.d
ifneq ($(EXTRA_PREFIX),)
EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
+1
View File
@@ -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:
+21
View File
@@ -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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.