From e498185356f69213897c9e03b4c27884dfa814cd Mon Sep 17 00:00:00 2001 From: dataCobra Date: Thu, 11 Aug 2022 07:27:11 +0200 Subject: [PATCH] khal: update to 0.10.5. --- srcpkgs/khal/files/khal.bash | 29 +++++++++++++++++++++++++++++ srcpkgs/khal/files/khal.fish | 22 ++++++++++++++++++++++ srcpkgs/khal/files/khal.zsh | 35 +++++++++++++++++++++++++++++++++++ srcpkgs/khal/template | 14 +++++++++----- 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 srcpkgs/khal/files/khal.bash create mode 100644 srcpkgs/khal/files/khal.fish create mode 100644 srcpkgs/khal/files/khal.zsh diff --git a/srcpkgs/khal/files/khal.bash b/srcpkgs/khal/files/khal.bash new file mode 100644 index 000000000000..1a8fd294fdf9 --- /dev/null +++ b/srcpkgs/khal/files/khal.bash @@ -0,0 +1,29 @@ +_khal_completion() { + local IFS=$'\n' + local response + + response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _KHAL_COMPLETE=bash_complete $1) + + for completion in $response; do + IFS=',' read type value <<< "$completion" + + if [[ $type == 'dir' ]]; then + COMPREPLY=() + compopt -o dirnames + elif [[ $type == 'file' ]]; then + COMPREPLY=() + compopt -o default + elif [[ $type == 'plain' ]]; then + COMPREPLY+=($value) + fi + done + + return 0 +} + +_khal_completion_setup() { + complete -o nosort -F _khal_completion khal +} + +_khal_completion_setup; + diff --git a/srcpkgs/khal/files/khal.fish b/srcpkgs/khal/files/khal.fish new file mode 100644 index 000000000000..9c02b4052bb5 --- /dev/null +++ b/srcpkgs/khal/files/khal.fish @@ -0,0 +1,22 @@ +function _khal_completion; + set -l response; + + for value in (env _KHAL_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) khal); + set response $response $value; + end; + + for completion in $response; + set -l metadata (string split "," $completion); + + if test $metadata[1] = "dir"; + __fish_complete_directories $metadata[2]; + else if test $metadata[1] = "file"; + __fish_complete_path $metadata[2]; + else if test $metadata[1] = "plain"; + echo $metadata[2]; + end; + end; +end; + +complete --no-files --command khal --arguments "(_khal_completion)"; + diff --git a/srcpkgs/khal/files/khal.zsh b/srcpkgs/khal/files/khal.zsh new file mode 100644 index 000000000000..21ce8b86c3b5 --- /dev/null +++ b/srcpkgs/khal/files/khal.zsh @@ -0,0 +1,35 @@ +#compdef khal + +_khal_completion() { + local -a completions + local -a completions_with_descriptions + local -a response + (( ! $+commands[khal] )) && return 1 + + response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _KHAL_COMPLETE=zsh_complete khal)}") + + for type key descr in ${response}; do + if [[ "$type" == "plain" ]]; then + if [[ "$descr" == "_" ]]; then + completions+=("$key") + else + completions_with_descriptions+=("$key":"$descr") + fi + elif [[ "$type" == "dir" ]]; then + _path_files -/ + elif [[ "$type" == "file" ]]; then + _path_files -f + fi + done + + if [ -n "$completions_with_descriptions" ]; then + _describe -V unsorted completions_with_descriptions -U + fi + + if [ -n "$completions" ]; then + compadd -U -V unsorted -a completions + fi +} + +compdef _khal_completion khal; + diff --git a/srcpkgs/khal/template b/srcpkgs/khal/template index 91143e91002c..48e3de880a4b 100644 --- a/srcpkgs/khal/template +++ b/srcpkgs/khal/template @@ -1,7 +1,7 @@ # Template file for 'khal' pkgname=khal -version=0.10.4 -revision=2 +version=0.10.5 +revision=1 build_style=python3-module hostmakedepends="python3-setuptools" depends="python3-setuptools python3-click python3-click-log python3-configobj @@ -11,18 +11,22 @@ checkdepends="python3-pytest python3-freezegun vdirsyncer $depends" short_desc="Command-line calendar build around CalDAV" maintainer="Anachron " license="MIT" +changelog="https://raw.githubusercontent.com/pimutils/khal/master/CHANGELOG.rst" homepage="http://lostpackets.de/khal/" distfiles="${PYPI_SITE}/k/khal/khal-${version}.tar.gz" -checksum=3fdb980a9a61c0206d7a82b16f77b408a4f341a2b866b9c9fcf6a641850d129f -make_check=ci-skip +checksum=4eefb7ac302a26d8606db392817587a4ed94c27a15bf2ea211614a464fcf0c76 +make_check=ci-skip # some tests fail when running as root pre_build() { vsed -i setup.py \ -e '/setup_requires=/d' \ -e "s|use_scm_version=.*|version='${version}',|" } + post_install() { vlicense COPYING - vinstall misc/__khal 644 usr/share/zsh/site-functions + vcompletion "${FILESDIR}/khal.bash" bash + vcompletion "${FILESDIR}/khal.fish" fish + vcompletion "${FILESDIR}/khal.zsh" zsh vsconf khal.conf.sample }