From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E5BA613877A for ; Mon, 25 Aug 2014 12:41:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A43CBE0909; Mon, 25 Aug 2014 12:41:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2C85CE0909 for ; Mon, 25 Aug 2014 12:41:06 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A187733DEE1 for ; Mon, 25 Aug 2014 12:41:05 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 47BDA3E1B for ; Mon, 25 Aug 2014 12:41:04 +0000 (UTC) From: "Vadim A. Misbakh-Soloviov" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vadim A. Misbakh-Soloviov" Message-ID: <1408970283.fd8e5c19b8ae8742886e62d9ec4609dacd97f4c0.mva@gentoo> Subject: [gentoo-commits] proj/zsh-completion:master commit in: / X-VCS-Repository: proj/zsh-completion X-VCS-Files: _eselect X-VCS-Directories: / X-VCS-Committer: mva X-VCS-Committer-Name: Vadim A. Misbakh-Soloviov X-VCS-Revision: fd8e5c19b8ae8742886e62d9ec4609dacd97f4c0 X-VCS-Branch: master Date: Mon, 25 Aug 2014 12:41:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4f64a356-a313-46fa-ab9b-f49da2700c8c X-Archives-Hash: 28fb5aaa6422c893676baa2e64be85c0 commit: fd8e5c19b8ae8742886e62d9ec4609dacd97f4c0 Author: Vadim A. Misbakh-Soloviov mva name> AuthorDate: Mon Aug 25 12:35:30 2014 +0000 Commit: Vadim A. Misbakh-Soloviov mva name> CommitDate: Mon Aug 25 12:38:03 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/zsh-completion.git;a=commit;h=fd8e5c19 _eselect: news support Signed-off-by: Vadim A. Misbakh-Soloviov mva.name> --- _eselect | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/_eselect b/_eselect index 1c1f6ec..796a819 100644 --- a/_eselect +++ b/_eselect @@ -112,6 +112,42 @@ _eselect_vi () { "update[Automatically update the vi provider]" } +_eselect_news() { + + ## TODO: Normal numeric sorting. + ## I've spent many time on trying to rewrite this + ## function to normally sort (to DO NOT sort, actually) items, + ## but it growing bigger and bigger and going to be too complicated. + ## So, I (mva) either need to help to make it in the "right way". + ## Or, maybe, to completely rewrite this compdef. + + local -a newslist; + if ((CURRENT == 3)); then + _values 'news options' $stdopts[@] \ + 'list[List news items]' \ + 'count[Display number of news items]' \ + 'purge[Purge read news]' \ + 'read[Read news items]' \ + 'unread[Mark read news items as unread again]' && return 0 + elif ((CURRENT == 4)); then + if (( $words[(I)(count)] )); then + _values -w 'news' 'new[Count only new news items]' 'all[Count all news items]' && return 0 + fi + + newslist=(${${${${${${${(M)${(f)"$(eselect --color=no news list)"}## *}// \**/}/ \[/}/\] ##/\[}/%/]}/ \[/ (}/\] /) }) + + if (( $words[(I)(read)] )); then + newslist+=( "new[Read unread news items (default)]" "all[Read all news items]" "--mbox[Output in mbox format]" "--quiet[Suppress output, only change status]" "--raw[Output in raw format]" ) + fi; + + if (( $words[(I)(unread)] )); then + newslist+=( "all[Unread all news items]" ) + fi + + _values -w 'news' $newslist[@] && return 0 + fi +} + _eselect () { local globopts modnames modopts @@ -131,7 +167,7 @@ _eselect () { _arguments -s \ "*:portage:_values 'eselect modules' \$modnames[@]" && return 0 elif (( $modnames[(I)$words[2]] )); then - if [[ "$words[2]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi) ]]; then + if [[ "$words[2]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi|news) ]]; then _eselect_$words[2] "$@" else modopts=(${${${(M)${(f)"$(eselect --brief --color=no $words[2] usage)"}## *}// */}// /}) @@ -142,7 +178,7 @@ _eselect () { elif ((CURRENT >= 4)); then if (( $words[(I)(--color=no|--colour=no)] )); then if (( $modnames[(I)$words[3]] )); then - if [[ "$words[3]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi) ]]; then + if [[ "$words[3]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi|news) ]]; then _eselect_$words[3] "$@" else modopts=(${${${${(M)${(f)"$(eselect --brief --color=no $words[3] usage)"}## *}// */}// /}// *}) @@ -152,7 +188,7 @@ _eselect () { fi else if (( $modnames[(I)$words[2]] )); then - _eselect_$words[2] "$@" + (( $+functions[_eselect_$words[2]] )) && _eselect_$words[2] "$@" fi fi fi