Permalink
Browse files

Remove combinator, add bash completion support.

  • Loading branch information...
1 parent e1c4eac commit 2ad0c0294eeaf2d0e016ab780e178c12197564c9 @dreid committed Sep 10, 2012
Showing with 51 additions and 5 deletions.
  1. +1 −1 dreid.sh
  2. +0 −4 dreid/combinator.sh
  3. +38 −0 dreid/completions.d/fix
  4. +7 −0 dreid/completions.sh
  5. +1 −0 dreid/env.sh
  6. +4 −0 dreid/shopts.sh
View
@@ -13,7 +13,7 @@ FILES=(
prompt
aliases
sshkeys
- combinator
+ completions
)
pushd ~/.bash.d/dreid > /dev/null
View
@@ -1,4 +0,0 @@
-if [[ -d ~/code/Divmod/trunk ]]; then
- eval `python ~/code/Divmod/trunk/Combinator/environment.py` \
- 2> ~/code/Divmod/trunk/Combinator/environment.log;
-fi
@@ -0,0 +1,38 @@
+_fix()
+{
+ local cur prev opts base
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+
+ if [[ "${cur}" == ":" ]]; then
+ # fix uses ':' to separate command from arguments. We don't want it to
+ # be cur because compgen won't do the right thing.
+ cur=''
+ fi
+
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ if [[ "${prev}" == ":" ]]; then
+ # fix uses ':' to separate command from arguments. We don't want it to
+ # be prev because the case statement below won't do the right thing.
+ prev="${COMP_WORDS[COMP_CWORD-2]}:"
+ fi
+
+ case "$prev" in
+ node:)
+ # Should use fix list_nodes but striping ansi escape sequences is hard.
+ local running=$(ls ./nodes/ | sed -e "s/\.json$//")
+ COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
+ local orders=$(fix -l | grep "^ " | cut -d' ' -f5)
+ COMPREPLY=($(compgen -o nospace -W "${orders}" -- ${cur}))
+ return 0
+
+}
+
+complete -F _fix fix
@@ -0,0 +1,7 @@
+if [ -f `brew --prefix`/etc/bash_completion ]; then
+ . `brew --prefix`/etc/bash_completion
+fi
+
+for f in $(find ./completions.d -type f); do
+ . $f;
+done
View
@@ -3,6 +3,7 @@ WORKON_HOME=~/.virtualenvs
mkdir -p $WORKON_HOME
PATH=/usr/local/bin:/usr/local/sbin:$PATH
+PATH=~/Library/Python/2.7/bin:$PATH
PATH=~/.rbenv/bin:~/bin:$PATH
EDITOR="subl -w"
View
@@ -2,3 +2,7 @@ shopt -s checkwinsize
shopt -s histappend
PROMPT_COMMAND="history -a"
+
+HISTIGNORE="&:[ ]*:exit:ls"
+
+export HISTIGNORE

0 comments on commit 2ad0c02

Please sign in to comment.