From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: files/misc/
Date: Fri, 13 Sep 2013 16:19:39 +0000 (UTC) [thread overview]
Message-ID: <1379088799.fb8237ed458933cf0ce2ed52d2e2abceebe9193e.dywi@gentoo> (raw)
commit: fb8237ed458933cf0ce2ed52d2e2abceebe9193e
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep 13 16:13:19 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> 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 <dir> arg
+ _filedir -d
+ ;;
+
+ '-O'|'--output')
+ # <dir>|<file>|-
+ _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
next reply other threads:[~2013-09-13 16:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 16:19 André Erdmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-07-18 16:20 [gentoo-commits] proj/R_overlay:master commit in: files/misc/ André Erdmann
2014-04-01 16:38 André Erdmann
2014-02-22 15:15 André Erdmann
2013-09-23 15:30 André Erdmann
2013-08-19 15:42 André Erdmann
2013-08-09 10:18 André Erdmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379088799.fb8237ed458933cf0ce2ed52d2e2abceebe9193e.dywi@gentoo \
--to=dywi@mailerd.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox