#compdef kanidmd

autoload -U is-at-least

_kanidmd() {
    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[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_kanidmd_commands" \
"*::: :->kanidm" \
&& ret=0
    case $state in
    (kanidm)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:kanidmd-command-$line[1]:"
        case $line[1] in
            (server)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(backup)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':path -- Output path for the backup content:_files' \
&& ret=0
;;
(restore)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':path -- Restore from this path. Should be created with "backup":_files' \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(recover_account)
_arguments "${_arguments_options[@]}" \
'-n+[The account name to recover credentials for]' \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(reindex)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(vacuum)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(domain_name_change)
_arguments "${_arguments_options[@]}" \
'-n+[The new domain name]' \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(db_scan)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_kanidmd__db_scan_commands" \
"*::: :->db_scan" \
&& ret=0
case $state in
    (db_scan)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:kanidmd-db_scan-command-$line[1]:"
        case $line[1] in
            (list_all_indexes)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(list_index)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':index-name -- The name of the index to list:_files' \
&& ret=0
;;
(list_id2entry)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(get_id2entry)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':id -- The id of the entry to display:_files' \
&& ret=0
;;
(list_index_analysis)
_arguments "${_arguments_options[@]}" \
'-d+[Logging level. quiet, default, filter, verbose, perffull]' \
'--debug=[Logging level. quiet, default, filter, verbose, perffull]' \
'-c+[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'--config=[Path to the server'\''s configuration file. If it does not exist, it will be created]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_kanidmd_commands] )) ||
_kanidmd_commands() {
    local commands; commands=(
        "server:Start the IDM Server" \
"backup:Backup the database content (offline)" \
"restore:Restore the database content (offline)" \
"verify:Verify database and entity consistency" \
"recover_account:Recover an account's password" \
"reindex:Reindex the database (offline)" \
"vacuum:Vacuum the database to reclaim space or change db_fs_type/page_size (offline)" \
"domain_name_change:Change the IDM domain name" \
"db_scan:Inspect the internal content of the database datastructures" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'kanidmd commands' commands "$@"
}
(( $+functions[_kanidmd__backup_commands] )) ||
_kanidmd__backup_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd backup commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan_commands] )) ||
_kanidmd__db_scan_commands() {
    local commands; commands=(
        "list_all_indexes:List all index tables that exist on the system" \
"list_index:List all content of a named index" \
"list_id2entry:List all id2entry values with reduced entry content" \
"get_id2entry:View the data of a specific entry from id2entry" \
"list_index_analysis:List all content of index analysis" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'kanidmd db_scan commands' commands "$@"
}
(( $+functions[_kanidmd__domain_name_change_commands] )) ||
_kanidmd__domain_name_change_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd domain_name_change commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan__get_id2entry_commands] )) ||
_kanidmd__db_scan__get_id2entry_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd db_scan get_id2entry commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan__help_commands] )) ||
_kanidmd__db_scan__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd db_scan help commands' commands "$@"
}
(( $+functions[_kanidmd__help_commands] )) ||
_kanidmd__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd help commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan__list_all_indexes_commands] )) ||
_kanidmd__db_scan__list_all_indexes_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd db_scan list_all_indexes commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan__list_id2entry_commands] )) ||
_kanidmd__db_scan__list_id2entry_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd db_scan list_id2entry commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan__list_index_commands] )) ||
_kanidmd__db_scan__list_index_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd db_scan list_index commands' commands "$@"
}
(( $+functions[_kanidmd__db_scan__list_index_analysis_commands] )) ||
_kanidmd__db_scan__list_index_analysis_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd db_scan list_index_analysis commands' commands "$@"
}
(( $+functions[_kanidmd__recover_account_commands] )) ||
_kanidmd__recover_account_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd recover_account commands' commands "$@"
}
(( $+functions[_kanidmd__reindex_commands] )) ||
_kanidmd__reindex_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd reindex commands' commands "$@"
}
(( $+functions[_kanidmd__restore_commands] )) ||
_kanidmd__restore_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd restore commands' commands "$@"
}
(( $+functions[_kanidmd__server_commands] )) ||
_kanidmd__server_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd server commands' commands "$@"
}
(( $+functions[_kanidmd__vacuum_commands] )) ||
_kanidmd__vacuum_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd vacuum commands' commands "$@"
}
(( $+functions[_kanidmd__verify_commands] )) ||
_kanidmd__verify_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'kanidmd verify commands' commands "$@"
}

_kanidmd "$@"