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 C978F1381F3 for ; Fri, 13 Sep 2013 16:19:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78C02E0BAC; Fri, 13 Sep 2013 16:19:42 +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 EBCD6E0BAC for ; Fri, 13 Sep 2013 16:19:41 +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 D327E33DF72 for ; Fri, 13 Sep 2013 16:19:40 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 881D8E468F for ; Fri, 13 Sep 2013 16:19:39 +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: <1379088799.fb8237ed458933cf0ce2ed52d2e2abceebe9193e.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: fb8237ed458933cf0ce2ed52d2e2abceebe9193e X-VCS-Branch: master Date: Fri, 13 Sep 2013 16:19:39 +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: dca01471-bf74-48ed-9208-66d44153130c X-Archives-Hash: 251d358ae06e59b245a1ac6db9d50615 commit: fb8237ed458933cf0ce2ed52d2e2abceebe9193e Author: André Erdmann mailerd de> AuthorDate: Fri Sep 13 16:13:19 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Fri Sep 13 16:13:19 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fb8237ed roverlay.bashcomp: roverlay-setup --- files/misc/roverlay.bashcomp | 123 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 106 insertions(+), 17 deletions(-) diff --git a/files/misc/roverlay.bashcomp b/files/misc/roverlay.bashcomp index 6f06508..63bc177 100644 --- a/files/misc/roverlay.bashcomp +++ b/files/misc/roverlay.bashcomp @@ -20,8 +20,8 @@ _roverlay_comp() { '--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' + '--manifest-implementation' '--pc' '--print-config' + '--ppr' '--print-package-rules' '--help-config' '--list-config-entries' '--dump-file' '--strict' '--stats' '--no-stats' '--dump-stats' ) @@ -74,19 +74,6 @@ _roverlay_comp() { 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 @@ -156,11 +143,11 @@ _roverlay_status_comp() { break fi else - first=n + first= fi done - if [[ "${have_mode}" ]]; then + if [[ -z "${have_mode}" ]]; then LONGOPTS+=( "${MODE_LONGOPTS[@]}" ) SHORTOPTS+=( "${MODE_SHORTOPTS[@]}" ) fi @@ -211,3 +198,105 @@ _roverlay_status_comp() { esac } complete -F _roverlay_status_comp roverlay-status + +_roverlay_setup_comp() { + local cur + local prev + + COMPREPLY=() + _get_comp_words_by_ref cur prev + + local LONGOPTS=( + '--help' '--usage' '--version' + '--work-root' '--data-root' '--conf-root' '--conf-dir' '--my-conf-root' + '--output' '--ask' '--expand-user' '--additions-dir' '--variable' + '--prjroot-relpath' '--enable-default-hooks' '--no-default-hooks' + '--import-config' '--no-import-config' '--target-uid' '--target-gid' + '--overwrite-hooks' '--relpath-hooks' '--no-relpath-hooks' + ) + local SHORTOPTS=( + '-h' '-V' '-W' '-D' '-C' '-O' '-a' '-A' '-v' '-I' + ) + + local CMDARGS=( 'init' 'hooks' 'mkconfig' ) + + local CONFIG_IMPORT_MODES=( + 'disable' 'symlink' 'symlink=root' 'symlink=dirs' 'symlink=files copy' + ) + local HOOK_OVERWRITE=( 'none' 'dead' 'links' 'all' ) + + local have_command + local k + local first=y + for k in "${COMP_WORDS[@]}"; do + if [[ " ${CMDARGS[*]} " == *" ${k} "* ]] && [[ -z "${first}" ]]; then + have_command="${k}" + case "${k}" in + 'init'|'hooks') + LONGOPTS+=( '--pretend' ) + SHORTOPTS+=( '-p' ) + ;; + esac + break + else + first= + fi + done + + case "${prev}" in + '-v'|'--variable') + : + ;; + + '-W'|'--work-root'|'-D'|'--data-root'|'--conf-root'|\ + '-C'|'--conf-dir'|'--my-conf-root'|'-A'|'--additions-dir') + # options with arg + _filedir -d + ;; + + '-O'|'--output') + # ||- + _filedir + [[ "${cur}" ]] || COMPREPLY+=( "-" ) + ;; + + '-I'|'--import-config') + COMPREPLY=( $(compgen -W "${CONFIG_IMPORT_MODES[*]}" -- "${cur}" ) ) + ;; + + '--overwrite-hooks') + COMPREPLY=( $(compgen -W "${HOOK_OVERWRITE[*]}" -- "${cur}" ) ) + ;; + + '--target-uid') + COMPREPLY=( $( compgen -u -- "${cur}" ) ) + #_uids + #COMPREPLY+= + ;; + + '--target-gid') + COMPREPLY=( $( compgen -g -- "${cur}" ) ) + #_gids + #COMPREPLY+= + ;; + + *) + 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_setup_comp roverlay-setup