X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=usr_share_grml%2Fzsh%2Ffunctions%2FLookup%2FLOOKUP_context;fp=usr_share_grml%2Fzsh%2Ffunctions%2FLookup%2FLOOKUP_context;h=60f72be80c96d76d4da25880d9bf056e603dd2c6;hb=1ee27bd79f2b8eae519f6890bc43f5feca13a261;hp=0000000000000000000000000000000000000000;hpb=9ae0b0c0858f15dc7ec46fbd86660dafc3946695;p=grml-etc-core.git diff --git a/usr_share_grml/zsh/functions/Lookup/LOOKUP_context b/usr_share_grml/zsh/functions/Lookup/LOOKUP_context new file mode 100644 index 0000000..60f72be --- /dev/null +++ b/usr_share_grml/zsh/functions/Lookup/LOOKUP_context @@ -0,0 +1,22 @@ +### vim:ft=zsh:foldmethod=marker +## get and set the current context +## Copyright: 2009, Frank Terbeck + +# If called without arguments, it spits out the current context. +# If called with -l it sets the of the context +# to . If called with -d, it sets the to its default. + +LOOKUP_guard || return 1 +local opt +local -A opts + +lu_parseopts_args=( d bool l string ) +LOOKUP_parseopts "$@" || return 1 +if [[ ${opts[-d]} == 'yes' ]] ; then + lookup_lp="-default-" +elif [[ -n ${opts[-l]} ]] ; then + lookup_lp="${opts[-l]}" +else + printf ':lookup:%s:%s:%s' ${lookup_ei} ${backend} ${lookup_lp} +fi +return 0