#compdef phraze

autoload -U is-at-least

_phraze() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'(-w --words -S --strength)-e+[Set minimum amount of entropy in bits for generated passphrase. If neither minimum_entropy or number_of_words is specified, Phraze will default to an 80-bit minimum]:MINIMUM_ENTROPY:_default' \
'(-w --words -S --strength)--minimum-entropy=[Set minimum amount of entropy in bits for generated passphrase. If neither minimum_entropy or number_of_words is specified, Phraze will default to an 80-bit minimum]:MINIMUM_ENTROPY:_default' \
'(-e --minimum-entropy -S --strength)-w+[Set exactly how many words to use in generated passphrase. If neither number_of_words or minimum_entropy is specified, Phraze will default to an 80-bit minimum]:NUMBER_OF_WORDS:_default' \
'(-e --minimum-entropy -S --strength)--words=[Set exactly how many words to use in generated passphrase. If neither number_of_words or minimum_entropy is specified, Phraze will default to an 80-bit minimum]:NUMBER_OF_WORDS:_default' \
'-n+[Number of passphrases to generate]:N_PASSPHRASES:_default' \
'--passphrases=[Number of passphrases to generate]:N_PASSPHRASES:_default' \
'-s+[Word separator. Can accept single quotes around the separator. To not use a separator, use empty single quotes\: '\'''\'']:SEPARATOR:_default' \
'--sep=[Word separator. Can accept single quotes around the separator. To not use a separator, use empty single quotes\: '\'''\'']:SEPARATOR:_default' \
'-l+[Choose a word list to use]:LIST_CHOICE:_default' \
'--list=[Choose a word list to use]:LIST_CHOICE:_default' \
'(-l --list)-c+[Provide a text file with a list of words to randomly generate passphrase from. Should be a text file with one word per line]:CUSTOM_LIST_FILE_PATH:_files' \
'(-l --list)--custom-list=[Provide a text file with a list of words to randomly generate passphrase from. Should be a text file with one word per line]:CUSTOM_LIST_FILE_PATH:_files' \
'(-w --words -e --minimum-entropy)*-S[Strengthen your passphrase the easy way\: Each -S flag increases minimum entropy by 20 bits (above the default of 80 bits)]' \
'(-w --words -e --minimum-entropy)*--strength[Strengthen your passphrase the easy way\: Each -S flag increases minimum entropy by 20 bits (above the default of 80 bits)]' \
'-t[Use Title Case for words in generated passphrase]' \
'--title-case[Use Title Case for words in generated passphrase]' \
'-v[Print estimated entropy of generated passphrase, in bits, along with the passphrase itself]' \
'--verbose[Print estimated entropy of generated passphrase, in bits, along with the passphrase itself]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

(( $+functions[_phraze_commands] )) ||
_phraze_commands() {
    local commands; commands=()
    _describe -t commands 'phraze commands' commands "$@"
}

if [ "$funcstack[1]" = "_phraze" ]; then
    _phraze "$@"
else
    compdef _phraze phraze
fi
