#compdef nix-init

autoload -U is-at-least

_nix-init() {
    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[@]}" : \
'-u+[Specify the URL]:URL: ' \
'--url=[Specify the URL]:URL: ' \
'-n+[Path to nixpkgs (in nix)]:NIXPKGS: ' \
'--nixpkgs=[Path to nixpkgs (in nix)]:NIXPKGS: ' \
'-C+[Commit the changes if the output path is name-based (RFC 140)]' \
'--commit=[Commit the changes if the output path is name-based (RFC 140)]' \
'-c+[Specify the config file]:CONFIG:_files' \
'--config=[Specify the config file]:CONFIG:_files' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::output -- The path or directory to output the generated file to:_files' \
&& ret=0
}

(( $+functions[_nix-init_commands] )) ||
_nix-init_commands() {
    local commands; commands=()
    _describe -t commands 'nix-init commands' commands "$@"
}

if [ "$funcstack[1]" = "_nix-init" ]; then
    _nix-init "$@"
else
    compdef _nix-init nix-init
fi
