From 686febc4fe2c1a118aeb2bfafe30d0508c9f5dee Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 7 Jan 2013 00:34:44 +1100 Subject: rename completion script to mxe-activate and unset env vars --- tools/mxe-activate | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tools/mxe-bash-completion | 45 --------------------------------------------- 2 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 tools/mxe-activate delete mode 100644 tools/mxe-bash-completion diff --git a/tools/mxe-activate b/tools/mxe-activate new file mode 100644 index 0000000..4f0d5e0 --- /dev/null +++ b/tools/mxe-activate @@ -0,0 +1,46 @@ +export MXE_DIR=`pwd` +export PATH=$MXE_DIR/usr/bin:$PATH +alias mxe='make -C $MXE_DIR' +unset `grep '^unexport' Makefile | gsed -n 's,unexport,,p' | tr '\n' ' '` + +_mxe() +{ + local cur prev pkgs tgts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + pkgs=$( for x in `ls -l $MXE_DIR/src/*.mk | gsed -n 's,.*src/\(.*\)\.mk,\1,p'`; do echo ${x} ; done ) + tgts="i686-pc-mingw32 x86_64-w64-mingw32 i686-w64-mingw32" + + case "${cur}" in + build-only-*_*) + local base=`echo ${cur} | gsed -n 's,\(.*_\).*,\1,p'` + local _tgts=$( for x in ${tgts}; do echo $base${x} ; done ) + COMPREPLY=( $(compgen -W "${_tgts}" -- ${cur}) ) + return 0 + ;; + build-only-*) + local _pkgs=$( for x in ${pkgs}; do echo build-only-${x} ; done ) + COMPREPLY=( $(compgen -W "${_pkgs}" -- ${cur}) ) + return 0 + ;; + download-*) + local _pkgs=$( for x in ${pkgs}; do echo download-${x} ; done ) + COMPREPLY=( $(compgen -W "${_pkgs}" -- ${cur}) ) + return 0 + ;; + update-checksum-*) + local _pkgs=$( for x in ${pkgs}; do echo update-checksum-${x} ; done ) + COMPREPLY=( $(compgen -W "${_pkgs}" -- ${cur}) ) + return 0 + ;; + [!-]*) + pkgs+=" build-only- check-requirements clean clean-pkg download download- update-checksum-" + COMPREPLY=( $(compgen -W "${pkgs}" -- ${cur}) ) + return 0 + ;; + esac + +} +complete -o nospace -o default -F _mxe mxe make diff --git a/tools/mxe-bash-completion b/tools/mxe-bash-completion deleted file mode 100644 index 66bdb66..0000000 --- a/tools/mxe-bash-completion +++ /dev/null @@ -1,45 +0,0 @@ -export MXE_DIR=`pwd` -export PATH=$MXE_DIR/usr/bin:$PATH -alias mxe='make -C $MXE_DIR' - -_mxe() -{ - local cur prev pkgs tgts - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - - pkgs=$( for x in `ls -l $MXE_DIR/src/*.mk | gsed -n 's,.*src/\(.*\)\.mk,\1,p'`; do echo ${x} ; done ) - tgts="i686-pc-mingw32 x86_64-w64-mingw32 i686-w64-mingw32" - - case "${cur}" in - build-only-*_*) - local base=`echo ${cur} | gsed -n 's,\(.*_\).*,\1,p'` - local _tgts=$( for x in ${tgts}; do echo $base${x} ; done ) - COMPREPLY=( $(compgen -W "${_tgts}" -- ${cur}) ) - return 0 - ;; - build-only-*) - local _pkgs=$( for x in ${pkgs}; do echo build-only-${x} ; done ) - COMPREPLY=( $(compgen -W "${_pkgs}" -- ${cur}) ) - return 0 - ;; - download-*) - local _pkgs=$( for x in ${pkgs}; do echo download-${x} ; done ) - COMPREPLY=( $(compgen -W "${_pkgs}" -- ${cur}) ) - return 0 - ;; - update-checksum-*) - local _pkgs=$( for x in ${pkgs}; do echo update-checksum-${x} ; done ) - COMPREPLY=( $(compgen -W "${_pkgs}" -- ${cur}) ) - return 0 - ;; - [!-]*) - pkgs+=" build-only- check-requirements clean clean-pkg download download- update-checksum-" - COMPREPLY=( $(compgen -W "${pkgs}" -- ${cur}) ) - return 0 - ;; - esac - -} -complete -o nospace -o default -F _mxe mxe make -- cgit v0.12