Corrected autocategory output in bash-completion; added output of --open,...

Corrected autocategory output in bash-completion; added output of --open, --show, --run flags in bash-completion
parent a56e8c81
......@@ -23,14 +23,14 @@ See details: `vitis --help`
## Ready-made packages
Latest version of tarball with sources: [vitis-0.10.3.tar.xz](https://bitbucket.org/vindexbit/vitis/downloads/vitis-0.10.3.tar.xz)
Latest version of tarball with sources: [vitis-0.10.4.tar.xz](https://bitbucket.org/vindexbit/vitis/downloads/vitis-0.10.4.tar.xz)
### x86_64
Latest version of deb-package: [vitis_0.10.3_amd64.deb](https://bitbucket.org/vindexbit/vitis/downloads/vitis_0.10.3_amd64.deb)
Latest version of deb-package: [vitis_0.10.4_amd64.deb](https://bitbucket.org/vindexbit/vitis/downloads/vitis_0.10.4_amd64.deb)
*Checked on Debian 10.*
*Checked on Debian 10 and Ubuntu 18.04*
---
......
* Sat Oct 12 2019 Eugene 'Vindex' Stulin <tech.vindex@gmail.com> 0.10.4
- improved bash-completion;
- error of access to Vitis directory is handled now;
- output "repeated_names" in category paths deleted;
- new categories is not created if files aren't found.
* Tue Oct 1 2019 Eugene 'Vindex' Stulin <tech.vindex@gmail.com> 0.10.3
- fixed a bug that could occur when renaming a category.
* Sun Aug 24 2019 Eugene 'Vindex' Stulin <tech.vindex@gmail.com> 0.10.2
......
......@@ -19,34 +19,11 @@ completeSpecificPath() {
declare -a tempArray
for ((i=0; i<length; i++)); do
if [[ "${COMPREPLY[$i]}" == __* ]]; then
if [[ "${COMPREPLY[$i]}" == "__auto/" ]]; then
continue
fi
for _item in ${rootAutoDirs[@]}; do
if [[ "${COMPREPLY[$i]}" == "${_item}" ]]; then
continue
fi
if [[ "${COMPREPLY[$i]}" == "${_item}*" ]]; then
tempArray+=${}${COMPREPLY[$i]}
continue
fi
done
continue
fi
tempArray[$i]=${COMPREPLY[$i]}
tempArray+=("${COMPREPLY[$i]}")
done
if [[ $method == WithDirs ]]; then
for _item in ${rootAutoDirs[@]}; do
pushd "${2}/${_item}" &>/dev/null || continue
_init_completion -s
_filedir
length=${#COMPREPLY[@]}
_COMPREPLY+=${COMPREPLY[0]}
popd &>/dev/null
done
fi
# iterate on original replies
for _item in "${tempArray[@]}"; do
if [[ $method == WithDirs && -d "${_item}" ]]; then
......@@ -66,10 +43,25 @@ completeSpecificPath() {
fi
done
# add autocategories to category list
if [[ $method == WithDirs ]]; then
for _item in ${rootAutoDirs[@]}; do
pushd "${2}/${_item}" &>/dev/null || continue
_init_completion -s
_filedir
length=${#COMPREPLY[@]}
for ((i=0; i<length; i++)); do
_COMPREPLY+=("${COMPREPLY[$i]}")
done
popd &>/dev/null
done
fi
popd &>/dev/null
# if only one reply and it is a directory, don't append a space
# (don't know why we must check for length == 2 though)
# (I don't know why we must check for length == 2)
if [ ${#_COMPREPLY[@]} -eq 2 ]; then
if [[ "${_COMPREPLY}" == */ ]]; then
compopt -o nospace
......@@ -98,11 +90,13 @@ subcommands="show open run create assign delete copy service --help --version"
subcommands_show="-e -v --all-categories"
options_show="--categories --details --fragment-info --hidden --reverse \
--ipaths --machine -n --no-colors --no-numbers --paths \
--sort=extension --sort=name --sort=none --sort=size --sort=time --sort=atime"
--sort=extension --sort=name --sort=none --sort=size --sort=time --sort=atime \
--open --run"
sorttypes="extension name none size time atime"
options_open="--app --hidden --mix -n --reverse --saved-page \
--sort=extension --sort=name --sort=none --sort=size --sort=time --sort=atime"
options_run="--app --mix -n --reverse --saved-page --sudo --user"
--sort=extension --sort=name --sort=none --sort=size --sort=time --sort=atime \
--show"
options_run="--app --mix -n --reverse --saved-page --sudo --user --show"
#for vitis service
options_get="path lang autosave opener casesensitivity autocategorization \
......@@ -145,7 +139,7 @@ _vitis()
return 0
elif [[ ${main_opt} == "--all-categories" ]]; then
COMPREPLY=( $(compgen -W "--auto --hidden" -- ${curr}) )
else #-e or nothing
else # -e or nothing
if [[ ${curr} == -* ]]; then
COMPREPLY=( $(compgen -W "${options_show}" -- ${curr}) )
elif [[ ${prev} == "--sort" && ${curr} == "=" ]]; then
......
0.10.3
\ No newline at end of file
0.10.4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment