aboutsummaryrefslogtreecommitdiff
path: root/ctct.bash_completion.in
diff options
context:
space:
mode:
Diffstat (limited to 'ctct.bash_completion.in')
-rw-r--r--ctct.bash_completion.in94
1 files changed, 0 insertions, 94 deletions
diff --git a/ctct.bash_completion.in b/ctct.bash_completion.in
deleted file mode 100644
index 54aa137..0000000
--- a/ctct.bash_completion.in
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env bash
-#
-# bash completion script for ctct
-#
-# Copyright 2015 - 2017 Einhard Leichtfuß
-#
-# This file is part of ctct.
-#
-# ctct is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# ctct is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with ctct. If not, see <https://www.gnu.org/licenses/>.
-#
-
-_ctct()
-{
- ## DEFAULT SETTINGS:
- local datadir="@default_datadir@"
- local system_config_dir="@default_confdir@"
- local user_config_dir="@default_user_config_dir@"
-
- local temp
-
- ## USER SETTINGS:
- temp=$(
- test -f "$system_config_dir/config.sh" \
- && source "$system_config_dir/config.sh"
- test -f "$user_config_dir/config.sh" \
- && source "$user_config_dir/config.sh"
- echo "$datadir"
- )
- test -n "$temp" && datadir="$temp"
-
- local cur action opts
- typeset -i i
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
- test $COMP_CWORD -gt 1 && action="${COMP_WORDS[1]}"
-
- if [ $COMP_CWORD -eq 1 ] && [[ "$cur" =~ ^- ]]
- then
- COMPREPLY=( $(compgen -W \
- "-h -l -s -S -e -d \
- --help --list-all --search-by-name --search-by-data --edit --delete \
- --rename --version" \
- -- "${cur}") )
- elif [ $COMP_CWORD -eq 1 ] \
- || ( [ $COMP_CWORD -eq 2 ] && \
- ( [ "$action" = "-e" ] \
- || ( [[ "--edit" =~ ^"$action" ]] && [ ${#action} -ge 3 ] ) \
- || ( [[ "--rename" =~ ^"$action" ]] && [ ${#action} -ge 3 ] ))) \
- || [ "$action" = "-d" ] \
- || ( [[ "--delete" =~ ^"$action" ]] && [ ${#action} -ge 3 ] )
- then
- i=0
- shopt -s nullglob
-
- for file in "$HOME/.ctct"/"$cur"*
- do
- COMPREPLY[i++]="${file##*/}"
- done
-
- if [[ "$cur" =~ \. ]]
- then
- cur=( ${cur/\./ } )
- for file in "$HOME/.ctct"/"${cur[1]}"*."${cur[0]}"
- do
- file="${file##*/}"
- COMPREPLY[i++]="${cur[0]}.${file%.*}"
- done
- else
- for file in "$HOME/.ctct"/*."$cur"*
- do
- file="${file##*/}"
- file=( ${file/\./ } )
- COMPREPLY[i++]="${file[1]}.${file[0]}"
- done
- fi
-
- shopt -u nullglob
- fi
-
- return 0
-}
-
-complete -F _ctct ctct