diff --git a/bashrc b/bashrc index 7615b15..0f31258 100644 --- a/bashrc +++ b/bashrc @@ -241,12 +241,49 @@ extract() function study() { - builtin cd "$BSI3_PATH" - echo -e "$RED WORK TO DO SOON:$BLUE" - calendar -A10 - echo -e -n "$DFT" + 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 "$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()