study function starting to be cool

This commit is contained in:
Frank Villaro-Dixon 2013-09-29 18:56:07 +02:00
parent 27cec3e613
commit 2b2a97c37d

46
bashrc
View file

@ -241,12 +241,49 @@ extract()
function study()
{
builtin cd "$BSI3_PATH"
if [ -z $1 ]; then
STUDY_PATH=''
else
if [ -d "$BSI3_PATH$1" ]; then
STUDY_PATH="$1"
else
STUDY_PATH=''
fi
fi
builtin cd "$BSI3_PATH$STUDY_PATH"
if [ -e calendar ]; then
echo -e "$RED WORK TO DO SOON:$BLUE"
calendar -A10
echo -e -n "$DFT"
echo -e "$DFT"
fi
ls
}
_StudyCompletion()
{ # {{{
local cur # Pointer to current completion word.
COMPREPLY=() # Array variable storing the possible completions.
cur=${COMP_WORDS[COMP_CWORD]}
_STUDY_ACTUAL_DIR=`pwd`
builtin cd "$BSI3_PATH"
ALL_POSSIBLE_WORDS=(*)
builtin cd "$_STUDY_ACTUAL_DIR"
for i in ${ALL_POSSIBLE_WORDS[@]}; do
# echo ">>>$i"
WORD=$(echo $i | grep "^$cur" | tr -d ' ') #ugly
if [ $WORD ]; then
COMPREPLY+=("$WORD");
fi;
done
return 0
} # }}}
complete -F _StudyCompletion -o filenames study
## FIXME TO IMPROVE WITH VARIOUS locations (ex: ro 1; ro 2; ro 3)
RO_ROOT_DIRECTORY=/dev/shm/ro_$USER
@ -288,7 +325,7 @@ function roset()
} # }}}
_RoRosetCompletion()
{
{ # {{{
local cur # Pointer to current completion word.
COMPREPLY=() # Array variable storing the possible completions.
@ -310,9 +347,8 @@ _RoRosetCompletion()
fi;
done
return 0
}
} # }}}
complete -F _RoRosetCompletion -o filenames ro roset
function calc()