rpms/environment-modules/devel bash_completion.in, NONE, 1.1 environment-modules.spec, 1.21, 1.22

Orion Poplawski orion at fedoraproject.org
Mon Sep 21 16:35:33 UTC 2009


Author: orion

Update of /cvs/pkgs/rpms/environment-modules/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13896

Modified Files:
	environment-modules.spec 
Added Files:
	bash_completion.in 
Log Message:
Add bash_completion.in from upstream CVS



--- NEW FILE bash_completion.in ---
#
# Bash commandline completion (bash 3.0 and above) for Modules @VERSION@
#
_module_avail() {
@VERSIONING@	@BASEPREFIX@/Modules/@VERSION@/bin/modulecmd bash -t avail 2>&1 | sed '
@NOTVERSIONING@	@bindir@/modulecmd bash -t avail 2>&1 | sed '
		/:$/d;
		/:ERROR:/d;
		s#^\(.*\)/\(.\+\)(default)#\1\n\1\/\2#;
		s#/(default)##g;
		s#/*$##g;'
}

_module_not_yet_loaded() {
	comm -23  <(_module_avail|sort)  <(tr : '\n' <<<${LOADEDMODULES}|sort)
}

_module_long_arg_list() {
	local cur="$1" i

	if [[ ${COMP_WORDS[COMP_CWORD-2]} == sw* ]]
	then
		COMPREPLY=( $(compgen -W "$(_module_not_yet_loaded)" -- "$cur") )
		return
	fi
	for ((i = COMP_CWORD - 1; i > 0; i--))
	do case ${COMP_WORDS[$i]} in
	   add|load)
		COMPREPLY=( $(compgen -W "$(_module_not_yet_loaded)" -- "$cur") )
		break;;
	   rm|remove|unload|switch|swap)
		COMPREPLY=( $(IFS=: compgen -W "${LOADEDMODULES}" -- "$cur") )
		break;;
	   esac
	done
}

_module() {
	local cur="$2" prev="$3" cmds opts

	COMPREPLY=()

	cmds="add apropos avail clear display help\
	      initadd initclear initlist initprepend initrm initswitch\
	      keyword list load purge refresh rm show swap switch\
	      unload unuse update use whatis"

	opts="-c -f -h -i -l -s -t -u -v -H -V\
	      --create --force  --help  --human   --icase\
	      --long   --silent --terse --userlvl --verbose --version"

	case "$prev" in
	add|load)	COMPREPLY=( $(compgen -W "$(_module_not_yet_loaded)" -- "$cur") );;
	rm|remove|unload|switch|swap)
			COMPREPLY=( $(IFS=: compgen -W "${LOADEDMODULES}" -- "$cur") );;
	unuse)		COMPREPLY=( $(IFS=: compgen -W "${MODULEPATH}" -- "$cur") );;
	use|*-a*)	;;			# let readline handle the completion
	-u|--userlvl)	COMPREPLY=( $(compgen -W "novice expert advanced" -- "$cur") );;
	display|help|show|whatis)
			COMPREPLY=( $(compgen -W "$(_module_avail)" -- "$cur") );;
	*) if test $COMP_CWORD -gt 2
	   then
		_module_long_arg_list "$cur"
	   else
		case "$cur" in
		# The mappings below are optional abbreviations for convenience
		ls)	COMPREPLY="list";;	# map ls -> list
		r*)	COMPREPLY="rm";;	# also covers 'remove'
		sw*)	COMPREPLY="switch";;

		-*)	COMPREPLY=( $(compgen -W "$opts" -- "$cur") );;
		*)	COMPREPLY=( $(compgen -W "$cmds" -- "$cur") );;
		esac
	   fi;;
	esac
}
complete -o default -F _module module


Index: environment-modules.spec
===================================================================
RCS file: /cvs/pkgs/rpms/environment-modules/devel/environment-modules.spec,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -p -r1.21 -r1.22
--- environment-modules.spec	21 Sep 2009 16:06:49 -0000	1.21
+++ environment-modules.spec	21 Sep 2009 16:35:32 -0000	1.22
@@ -7,6 +7,8 @@ Group:          System Environment/Base
 License:        GPLv2+
 URL:            http://modules.sourceforge.net/
 Source0:        http://downloads.sourceforge.net/modules/modules-%{version}.tar.bz2
+#Pulled this from current CVS, missing from 3.2.7 tarball
+Source1:        bash_completion.in
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  tcl-devel, tclx-devel, libX11-devel
@@ -38,6 +40,7 @@ have access to the module alias.
 
 %prep
 %setup -q -n modules-%{version}
+cp -p %SOURCE1 init/
 
 
 %build




More information about the fedora-extras-commits mailing list