diff options
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | PKGBUILD | 33 | ||||
-rw-r--r-- | rename_todoist_to_todoist_cli.patch | 141 |
4 files changed, 169 insertions, 17 deletions
@@ -1,6 +1,6 @@ pkgbase = todoist-git pkgdesc = Todoist CLI Client, written in Golang. - pkgver = r324.2a9f649 + pkgver = r326.45738fb pkgrel = 1 url = https://github.com/sachaos/todoist arch = x86_64 @@ -10,10 +10,14 @@ pkgbase = todoist-git makedepends = git optdepends = peco: for zsh functions script provides = todoist + provides = todoist-cli conflicts = todoist + conflicts = todoist-cli options = !strip options = !emptydirs - source = todoist-git::git://github.com/sachaos/todoist.git - md5sums = SKIP + source = git+https://github.com/sachaos/todoist.git + source = rename_todoist_to_todoist_cli.patch + sha256sums = SKIP + sha256sums = 2d0f8626b98c6b178d6be15ad03be20a49c18add0cb3ec2a1f06e8e727785564 pkgname = todoist-git diff --git a/.gitignore b/.gitignore index 32f0ae164510..b7a9e9350364 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ src/ +todoist/ pkg/ +*.zst *.tar.gz *.tar.xz @@ -3,9 +3,10 @@ # Contributor: Thor K. Høgås <thor at roht no> # Contributor: Austin Keller -_pkgname=todoist -pkgname=${_pkgname}-git -pkgver=r324.2a9f649 +_reponame=todoist +_pkgname=$_reponame-cli +pkgname=${_reponame}-git +pkgver=r326.45738fb pkgrel=1 pkgdesc="Todoist CLI Client, written in Golang." arch=('x86_64' 'i686') @@ -14,13 +15,15 @@ license=('MIT') makedepends=('go' 'git') optdepends=('peco: for zsh functions script') options=('!strip' '!emptydirs') -source=("${pkgname}::git://github.com/sachaos/todoist.git") -md5sums=('SKIP') -provides=('todoist') -conflicts=('todoist') +source=('git+https://github.com/sachaos/todoist.git' + 'rename_todoist_to_todoist_cli.patch' ) +sha256sums=('SKIP' + '2d0f8626b98c6b178d6be15ad03be20a49c18add0cb3ec2a1f06e8e727785564') +provides=('todoist' 'todoist-cli') +conflicts=('todoist' 'todoist-cli') pkgver() { - cd "$pkgname" + cd "$_reponame" ( set -o pipefail git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" @@ -29,23 +32,25 @@ pkgver() { prepare() { mkdir -p "$srcdir/go/src/github.com/sachaos" - ln -sf "$srcdir/$pkgname" "$srcdir/go/src/github.com/sachaos/$_pkgname" + ln -sf "$srcdir/$_reponame" "$srcdir/go/src/github.com/sachaos/$_reponame" + patch --directory="$_reponame" --forward --strip=1 --input="${srcdir}/rename_todoist_to_todoist_cli.patch" } build() { export GOPATH="$srcdir/go" export PATH="$PATH:$srcdir/go/bin/" export GO111MODULE="on" - cd "$srcdir/go/src/github.com/sachaos/$_pkgname" + cd "$srcdir/go/src/github.com/sachaos/todoist" make install chmod u+w -R "$GOPATH" } package() { - install -Dm755 "$srcdir/go/bin/$_pkgname" "$pkgdir/usr/bin/$_pkgname" - cd "$srcdir/go/src/github.com/sachaos/$_pkgname" - install -Dm644 todoist_functions.sh "${pkgdir}/usr/share/todoist/todoist_functions.sh" - install -Dm644 todoist_functions_fzf.sh "${pkgdir}/usr/share/todoist/todoist_functions_fzf.sh" + install -Dm755 "$srcdir/go/bin/$_reponame" "$pkgdir/usr/bin/$_pkgname" + cd "$srcdir/go/src/github.com/sachaos/$_reponame" + install -Dm644 todoist_functions.sh "${pkgdir}/usr/share/$_pkgname/todoist_functions.sh" + install -Dm644 todoist_functions_fzf.sh "${pkgdir}/usr/share/$_pkgname/todoist_functions_fzf.sh" + install -Dm644 todoist_functions_fzf_bash.sh "${pkgdir}/usr/share/$_pkgname/todoist_functions_fzf_bash.sh" mkdir -p "$pkgdir/usr/share/licenses/$_pkgname" install -m 0644 LICENSE "$pkgdir/usr/share/licenses/$_pkgname/" } diff --git a/rename_todoist_to_todoist_cli.patch b/rename_todoist_to_todoist_cli.patch new file mode 100644 index 000000000000..870756f4660a --- /dev/null +++ b/rename_todoist_to_todoist_cli.patch @@ -0,0 +1,141 @@ +diff --git a/todoist_functions.sh b/todoist_functions.sh +index ad4e7ce..b7b1e7a 100644 +--- a/todoist_functions.sh ++++ b/todoist_functions.sh +@@ -1,4 +1,4 @@ +-select_items_command="todoist --namespace --project-namespace list | peco | cut -d ' ' -f 1 | tr '\n' ' '" ++select_items_command="todoist-cli --namespace --project-namespace list | peco | cut -d ' ' -f 1 | tr '\n' ' '" + + function insert-in-buffer () { + if [ -n "$1" ]; then +@@ -25,7 +25,7 @@ bindkey "^xtt" peco-todoist-item + + # todoist find project + function peco-todoist-project () { +- local SELECTED_PROJECT="$(todoist --project-namespace projects | peco | head -n1 | cut -d ' ' -f 1)" ++ local SELECTED_PROJECT="$(todoist-cli --project-namespace projects | peco | head -n1 | cut -d ' ' -f 1)" + insert-in-buffer "${SELECTED_PROJECT}" "-P" + } + zle -N peco-todoist-project +@@ -33,7 +33,7 @@ bindkey "^xtp" peco-todoist-project + + # todoist find labels + function peco-todoist-labels () { +- local SELECTED_LABELS="$(todoist labels | peco | cut -d ' ' -f 1 | tr '\n' ',' | sed -e 's/,$//')" ++ local SELECTED_LABELS="$(todoist-cli labels | peco | cut -d ' ' -f 1 | tr '\n' ',' | sed -e 's/,$//')" + insert-in-buffer "${SELECTED_LABELS}" "-L" + } + zle -N peco-todoist-labels +@@ -58,7 +58,7 @@ bindkey "^xtd" peco-todoist-date + + function todoist-exec-with-select-task () { + if [ -n "$2" ]; then +- BUFFER="todoist $1 $(echo "$2" | tr '\n' ' ')" ++ BUFFER="todoist-cli $1 $(echo "$2" | tr '\n' ' ')" + CURSOR=$#BUFFER + zle accept-line + fi +diff --git a/todoist_functions_fzf.sh b/todoist_functions_fzf.sh +index b234dd5..9b01e73 100644 +--- a/todoist_functions_fzf.sh ++++ b/todoist_functions_fzf.sh +@@ -1,4 +1,4 @@ +-select_items_command="todoist --namespace --project-namespace list | fzf | cut -d ' ' -f 1 | tr '\n' ' '" ++select_items_command="todoist-cli --namespace --project-namespace list | fzf | cut -d ' ' -f 1 | tr '\n' ' '" + + function insert-in-buffer () { + if [ -n "$1" ]; then +@@ -25,7 +25,7 @@ bindkey "^xtt" fzf-todoist-item + + # todoist find project + function fzf-todoist-project () { +- local SELECTED_PROJECT="$(todoist --project-namespace projects | fzf | head -n1 | cut -d ' ' -f 1)" ++ local SELECTED_PROJECT="$(todoist-cli --project-namespace projects | fzf | head -n1 | cut -d ' ' -f 1)" + insert-in-buffer "${SELECTED_PROJECT}" "-P" + } + zle -N fzf-todoist-project +@@ -33,7 +33,7 @@ bindkey "^xtp" fzf-todoist-project + + # todoist find labels + function fzf-todoist-labels () { +- local SELECTED_LABELS="$(todoist labels | fzf | cut -d ' ' -f 1 | tr '\n' ',' | sed -e 's/,$//')" ++ local SELECTED_LABELS="$(todoist-cli labels | fzf | cut -d ' ' -f 1 | tr '\n' ',' | sed -e 's/,$//')" + insert-in-buffer "${SELECTED_LABELS}" "-L" + } + zle -N fzf-todoist-labels +@@ -58,7 +58,7 @@ bindkey "^xtd" fzf-todoist-date + + function todoist-exec-with-select-task () { + if [ -n "$2" ]; then +- BUFFER="todoist $1 $(echo "$2" | tr '\n' ' ')" ++ BUFFER="todoist-cli $1 $(echo "$2" | tr '\n' ' ')" + CURSOR=$#BUFFER + zle accept-line + fi +diff --git a/todoist_functions_fzf_bash.sh b/todoist_functions_fzf_bash.sh +index b804b4f..792b20c 100644 +--- a/todoist_functions_fzf_bash.sh ++++ b/todoist_functions_fzf_bash.sh +@@ -27,14 +27,14 @@ _todoist() { + + for arg in "${COMP_WORDS[@]}"; do + case "$arg" in +- todoist) +- cmd='todoist' ++ todoist-cli) ++ cmd='todoist-cli' + ;; + # These are the current commands; not all have completion options, + # but they're listed here anyway, for the future + list|show|completed-list|add|modify|close|delete|labels|projects|\ + karma|sync|quick|help) +- [ "$cmd" == 'todoist' ] && cmd+="__$arg" ++ [ "$cmd" == 'todoist-cli' ] && cmd+="__$arg" + ;; + l) + cmd+='__list' +@@ -74,7 +74,7 @@ _todoist() { + ' --project-namespace --help -h --version -v ' + + case "$cmd" in +- todoist) ++ todoist-cli) + opts+='list l show completed-list c-l cl add a modify m close c'\ + ' delete d labels projects karma sync s quick q help h' + ;; +@@ -98,17 +98,17 @@ _todoist() { + ;; + --label-ids|-L) + # shellcheck disable=SC2207 +- COMPREPLY=( $(todoist labels | $fzfcmd --multi | cut -d ' ' -f 1 \ ++ COMPREPLY=( $(todoist-cli labels | $fzfcmd --multi | cut -d ' ' -f 1 \ + | paste -d, -s -) ) + return 0 + ;; + --project-id|-P) + # shellcheck disable=SC2207 +- COMPREPLY=( $(todoist projects | $fzfcmd | cut -d ' ' -f 1) ) ++ COMPREPLY=( $(todoist-cli projects | $fzfcmd | cut -d ' ' -f 1) ) + return 0 + ;; + --project-name|-N) +- COMPREPLY=( "'$(todoist projects | $fzfcmd | cut -d ' ' -f 2- \ ++ COMPREPLY=( "'$(todoist-cli projects | $fzfcmd | cut -d ' ' -f 2- \ + | cut -b 2- )'" ) + return 0 + ;; +@@ -144,7 +144,7 @@ _todoist() { + __todoist_debug "fzfcmd=$fzfcmd" + + # shellcheck disable=SC2207 +- COMPREPLY=( $(todoist --namespace --project-namespace list \ ++ COMPREPLY=( $(todoist-cli --namespace --project-namespace list \ + | $fzfcmd | cut -d ' ' -f 1 | tr -d "'") ) + return 0 + fi +@@ -155,4 +155,4 @@ _todoist() { + [ -n "$opts" ] && COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) + } + +-complete -F _todoist todoist ++complete -F _todoist todoist-cli |