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 D59591381F3 for ; Fri, 9 Aug 2013 10:18:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A1223E0C11; Fri, 9 Aug 2013 10:18:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DCBADE0C11 for ; Fri, 9 Aug 2013 10:18:08 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B783E33EBC8 for ; Fri, 9 Aug 2013 10:18:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 49E6AE5460 for ; Fri, 9 Aug 2013 10:18:06 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1376043298.e65b3e5e4dba9e1895fa48ad1acfa4098341ca24.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: files/misc/ X-VCS-Repository: proj/R_overlay X-VCS-Files: files/misc/roverlay.bashcomp X-VCS-Directories: files/misc/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: e65b3e5e4dba9e1895fa48ad1acfa4098341ca24 X-VCS-Branch: master Date: Fri, 9 Aug 2013 10:18:06 +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: 2d5af88d-06c9-4452-980b-c28a5e63297e X-Archives-Hash: 9494a2f733709f4454ccc4f3f2892d08 commit: e65b3e5e4dba9e1895fa48ad1acfa4098341ca24 Author: André Erdmann mailerd de> AuthorDate: Fri Aug 9 10:14:58 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Fri Aug 9 10:14:58 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e65b3e5e files/misc: bash completion for roverlay --- files/misc/roverlay.bashcomp | 116 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/files/misc/roverlay.bashcomp b/files/misc/roverlay.bashcomp new file mode 100644 index 0000000..2f18ee9 --- /dev/null +++ b/files/misc/roverlay.bashcomp @@ -0,0 +1,116 @@ +# R overlay -- bash completion for roverlay +# -*- coding: utf-8 -*- + +_roverlay_comp() { + local cur + local prev + + COMPREPLY=() + _get_comp_words_by_ref cur prev + + local LONGOPTS=( + '--help' '--version' + '--config' '--field-definition' '--fdef' '--repo-config' + '--deprule-file' '--package-rules' '--overlay' '--overlay-name' + '--additions-dir' + '--write-overlay' '--write' '--no-write-overlay' '--no-write' + '--show-overlay' '--show' '--no-show-overlay' '--no-show' + '--strict-sync' '--sync' '--nosync' '--no-sync' '--sync-imports' + '--distroot' '--force-distroot' '--local-distdir' '--from' + '--incremental' '--no-incremental' '--fixup-category-move' + '--fixup-category-move-reverse' '--distmap-verify' '--revbump' + '--no-revbump' '--immediate-ebuild-writes' '--manifest' '--no-manifest' + '--manifest-implementation' '--target-uid' '--target-gid' '--pc' + '--print-config' '--ppr' '--print-package-rules' + '--help-config' '--list-config-entries' '--dump-file' '--strict' + '--stats' '--no-stats' '--dump-stats' + ) + + local SHORTOPTS=( + '-h' '-V' '-c' '-F' '-R' '-D' '-P' '-O' '-N' '-A' '-M' + ) + + local CMDARGS=( + 'sync' 'create' 'depres' 'depres_console' 'nop' 'apply_rules' + 'setupdirs' + ) + + local have_command= + local k + local first=y + for k in "${COMP_WORDS[@]}"; do + if [[ " ${CMDARGS[*]} " == *" ${k} "* ]] && [[ -z "${first}" ]]; then + have_command=y + break + fi + first= + done + + case "${prev}" in + '-c'|'--config'|'-F'|'--field-definition'|'--fdef'|\ + '-R'|'--repo-config') + # options with arg + _filedir + ;; + + '-O'|'--overlay'|'-A'|'--additions-dir'|'--distroot'|\ + '--local-distdir'|'--from') + # options with arg + _filedir -d + ;; + + '-D'|'--deprule-file'|'-P'|'--package-rules') + # options with arg + _filedir + ;; + + '--dump-file') + # stdout or file + _filedir + [[ "${cur}" ]] || COMPREPLY+=( "-" ) + ;; + + '-M'|'--manifest-implementation') + COMPREPLY=( $(compgen -W "default next ebuild e" -- "${cur}" ) ) + ;; + + '--target-uid') + COMPREPLY=( $( compgen -u -- "${cur}" ) ) + #_uids + #COMPREPLY+= + ;; + + '--target-gid') + COMPREPLY=( $( compgen -g -- "${cur}" ) ) + #_gids + #COMPREPLY+= + ;; + + + '-N'|'--overlay-name') + # options with str/unspecified arg + true + ;; + + *) + case "${cur}" in + --*) + COMPREPLY=( $( compgen -W "${LONGOPTS[*]}" -- "${cur}" ) ) + ;; + -*) + COMPREPLY=( + $( compgen -W "${LONGOPTS[*]} ${SHORTOPTS[*]}" -- "${cur}" ) + ) + ;; + *) + local words="${LONGOPTS[*]} ${SHORTOPTS[*]}" + [[ "${have_command}" ]] || words+=" ${CMDARGS[*]}" + COMPREPLY=( $( compgen -W "${words}" -- "${cur}" ) ) + ;; + esac + + ;; + esac +} + +complete -F _roverlay_comp roverlay