2011-11-01 22:14:45 +02:00
|
|
|
# bash completion for openldap -*- shell-script -*-
|
2009-05-18 23:03:37 +02:00
|
|
|
|
|
|
|
_ldap_uris()
|
|
|
|
{
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) )
|
2009-05-18 23:03:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_ldap_protocols()
|
|
|
|
{
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) )
|
2009-05-18 23:03:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_ldapsearch()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-T)
|
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-f|-y)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-s)
|
|
|
|
COMPREPLY=( $( compgen -W 'base one sub children' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-a)
|
|
|
|
COMPREPLY=( $( compgen -W 'never always search find' \
|
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-P)
|
|
|
|
_ldap_protocols
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldapsearch ldapsearch
|
|
|
|
|
|
|
|
_ldapaddmodify()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-S|-f|-y)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-P)
|
|
|
|
_ldap_protocols
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldapaddmodify ldapadd ldapmodify
|
|
|
|
|
|
|
|
_ldapdelete()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-f|-y)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-P)
|
|
|
|
_ldap_protocols
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldapdelete ldapdelete
|
|
|
|
|
|
|
|
_ldapcompare()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-y)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-P)
|
|
|
|
_ldap_protocols
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldapcompare ldapcompare
|
|
|
|
|
|
|
|
_ldapmodrdn()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-f|-y)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-P)
|
|
|
|
_ldap_protocols
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -ZZ -MM' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldapmodrdn ldapmodrdn
|
|
|
|
|
|
|
|
_ldapwhoami()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-f|-y)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-P)
|
|
|
|
_ldap_protocols
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldapwhoami ldapwhoami
|
|
|
|
|
|
|
|
_ldappasswd()
|
|
|
|
{
|
2011-04-20 22:56:30 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2009-10-04 19:42:50 +02:00
|
|
|
-h)
|
|
|
|
_known_hosts_real "$cur"
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-H)
|
|
|
|
_ldap_uris
|
|
|
|
return 0
|
|
|
|
;;
|
2009-11-22 11:43:26 +01:00
|
|
|
-t|-T|-y)
|
2009-10-04 19:42:50 +02:00
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-18 23:03:37 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:34:23 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) -MM -ZZ' -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:03:37 +02:00
|
|
|
complete -F _ldappasswd ldappasswd
|
2009-10-01 20:54:51 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|