add targetmail and bash completion for trashmail
This commit is contained in:
parent
bd86707429
commit
bc9c77215d
2 changed files with 21 additions and 2 deletions
14
bash_completion.d/trashmail
Normal file
14
bash_completion.d/trashmail
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
function _trashmail() {
|
||||
COMPREPLY=()
|
||||
local CUR KEYS
|
||||
CUR="${COMP_WORDS[COMP_CWORD]}"
|
||||
KEYS=$(ldapsearch -LLL -Z -H ldap://${LDAP_HOST_DEFAULT} -D ${LDAP_ADMIN_BIND_DN} -x -w $(pass ${PASS_ID_LDAP_ADMIN}|head -n 1) -b ou=mailaccounts,dc=schuerz,dc=at '(&(dcAccountStatus=active)(objectClass=dcExternalMailAccount))' dcSubMailAddress|grep "^dcSubMailAddress"|awk '{print $2}')
|
||||
COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _trashmail trashmail
|
||||
|
||||
|
||||
|
|
@ -34,6 +34,7 @@ show_help () {
|
|||
--help show this help/usage
|
||||
-l|--length <INTEGER>|full cut hashed part of username to <INTGER> characters from start (default: ${HASHLENGHT_DEFAULT})
|
||||
-n|--not-hashed do not hash username from targetdomain and linux-login-user
|
||||
-t|--target-mail <TARGET_MAIL> Emailadress for which trashmail is created
|
||||
-w|--full-hash do not cut hash (same as »-l full«)
|
||||
-y|--symbols same option as in pwgen. Include at least one special character in the password.
|
||||
|
||||
|
@ -43,8 +44,8 @@ EOF
|
|||
}
|
||||
|
||||
# TODO: how exit main-shell from error in subshell???
|
||||
getopt -u -o dfhl:nwy --long delete,force,hashed,help,not-hashed,hashlength:,whole-hash,symblols -- "$@" || exit $?
|
||||
set -- $(getopt -u -o dfhl:nwy --long delete,force,hashed,help,not-hashed,hashlength:,whole-hash,symblols -- "$@"|| exit $?)
|
||||
getopt -u -o dfhl:nt:wy --long delete,force,hashed,help,not-hashed,hashlength:,whole-hash,symblols,target-mail: -- "$@" || exit $?
|
||||
set -- $(getopt -u -o dfhl:nt:wy --long delete,force,hashed,help,not-hashed,hashlength:,whole-hash,symblols,target-mail: -- "$@"|| exit $?)
|
||||
|
||||
echo @: $@
|
||||
while : ; do
|
||||
|
@ -77,6 +78,10 @@ while : ; do
|
|||
HASHED=false
|
||||
shift
|
||||
;;
|
||||
-t|--target-mail)
|
||||
TARGET_MAIL=$2
|
||||
shift; shift;
|
||||
;;
|
||||
-w|--full-hash)
|
||||
HASHLENGTH=full
|
||||
shift;
|
||||
|
|
Loading…
Reference in a new issue