#compdef dcg

_dcg()
{
    local state com cur

    cur=${words[${#words[@]}]}

    # lookup for command
    for word in ${words[@]:1}; do
        if [[ $word != -* ]]; then
            com=$word
            break
        fi
    done

    if [[ ${cur} == --* ]]; then
        state="option"
        opts=("--help:Display help for the given command. When no command is given display help for the <info>navigation</info> command" "--verbose:Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug" "--version:Display this application version" "--ansi:Force \(or disable --no-ansi\) ANSI output" "--no-ansi:Negate the "--ansi" option" "--working-dir:Working directory" "--answer:Answer to generator question" "--dry-run:Output the generated code but not save it to file system" "--full-path:Print full path to generated assets" "--destination:Path to a base directory for file writing" "--replace:Replace existing assets without confirmation")
    elif [[ $cur == $com ]]; then
        state="command"
        coms=("_complete:Internal command to provide shell completion suggestions" "completion:Dump the shell completion script" "composer:Generates a composer.json file" "controller:Generates a controller" "field:Generates a field" "generate-completion:Generates shell completion" "help:Display help for a command" "hook:Generates a hook" "install-file:Generates an install file" "javascript:Generates Drupal JavaScript file" "layout:Generates a layout" "list:List commands" "module:Generates Drupal module" "module-file:Generates a module file" "navigation:Command line code generator" "phpstorm-metadata:Generates PhpStorm metadata" "plugin-manager:Generates plugin manager" "render-element:Generates Drupal render element" "service-provider:Generates a service provider" "template:Generates a template" "theme:Generates Drupal theme" "theme-file:Generates a theme file" "theme-settings:Generates Drupal theme-settings.php file" "console\:dcg-command:Generates DCG command" "console\:symfony-command:Generates Symfony console command" "entity\:bundle-class:Generate a bundle class for a content entity." "entity\:configuration:Generates configuration entity" "entity\:content:Generates content entity" "form\:config:Generates a configuration form" "form\:confirm:Generates a confirmation form" "form\:simple:Generates simple form" "misc\:apache-virtual-host:Generates an Apache site configuration file" "misc\:nginx-virtual-host:Generates an Nginx site configuration file" "plugin\:action:Generates action plugin" "plugin\:block:Generates block plugin" "plugin\:ckeditor:Generates CKEditor plugin" "plugin\:condition:Generates condition plugin" "plugin\:constraint:Generates constraint plugin" "plugin\:entity-reference-selection:Generates entity reference selection plugin" "plugin\:field\:formatter:Generates field formatter plugin" "plugin\:field\:type:Generates field type plugin" "plugin\:field\:widget:Generates field widget plugin" "plugin\:filter:Generates filter plugin" "plugin\:menu-link:Generates menu-link plugin" "plugin\:migrate\:destination:Generates migrate destination plugin" "plugin\:migrate\:process:Generates migrate process plugin" "plugin\:migrate\:source:Generates migrate source plugin" "plugin\:queue-worker:Generates queue worker plugin" "plugin\:rest-resource:Generates rest resource plugin" "plugin\:views\:argument-default:Generates views default argument plugin" "plugin\:views\:field:Generates views field plugin" "plugin\:views\:style:Generates views style plugin" "service\:access-checker:Generates an access checker service" "service\:breadcrumb-builder:Generates a breadcrumb builder service" "service\:cache-context:Generates a cache context service" "service\:custom:Generates a custom Drupal service" "service\:event-subscriber:Generates an event subscriber" "service\:logger:Generates a logger service" "service\:middleware:Generates a middleware" "service\:param-converter:Generates a param converter service" "service\:path-processor:Generates a path processor service" "service\:request-policy:Generates a request policy service" "service\:response-policy:Generates a response policy service" "service\:route-subscriber:Generates a route subscriber" "service\:theme-negotiator:Generates a theme negotiator" "service\:twig-extension:Generates Twig extension service" "service\:uninstall-validator:Generates a uninstall validator service" "test\:browser:Generates a browser based test" "test\:kernel:Generates a kernel based test" "test\:nightwatch:Generates a nightwatch test" "test\:unit:Generates a unit test" "test\:webdriver:Generates a test that supports JavaScript" "yml\:breakpoints:Generates a breakpoints yml file" "yml\:links\:action:Generates a links.action yml file" "yml\:links\:contextual:Generates links.contextual yml file" "yml\:links\:menu:Generates a links.menu yml file" "yml\:links\:task:Generates a links.task yml file" "yml\:module-info:Generates a module info yml file" "yml\:module-libraries:Generates module libraries yml file" "yml\:permissions:Generates a permissions yml file" "yml\:routing:Generates a routing yml file" "yml\:services:Generates a services yml file" "yml\:theme-info:Generates a theme info yml file" "yml\:theme-libraries:Generates theme libraries yml file")
    fi

    case $state in
        command)
            _describe 'command' coms
        ;;
        option)
            case "$com" in

            _complete)
            opts+=("--shell:The shell type \("bash", "fish"\)" "--input:An array of input tokens \(e.g. COMP_WORDS or argv\)" "--current:The index of the "input" array that the cursor is in \(e.g. COMP_CWORD\)" "--symfony:The version of the completion script")
            ;;

            completion)
            opts+=("--debug:Tail the completion debug log")
            ;;

            composer)
            opts+=()
            ;;

            controller)
            opts+=()
            ;;

            field)
            opts+=()
            ;;

            generate-completion)
            opts+=("--shell:Shell type")
            ;;

            help)
            opts+=("--format:The output format \(txt, xml, json, or md\)" "--raw:To output raw command help")
            ;;

            hook)
            opts+=()
            ;;

            install-file)
            opts+=()
            ;;

            javascript)
            opts+=()
            ;;

            layout)
            opts+=()
            ;;

            list)
            opts+=("--raw:To output raw command list" "--format:The output format \(txt, xml, json, or md\)" "--short:To skip describing commands\' arguments")
            ;;

            module)
            opts+=()
            ;;

            module-file)
            opts+=()
            ;;

            navigation)
            opts+=()
            ;;

            phpstorm-metadata)
            opts+=()
            ;;

            plugin-manager)
            opts+=()
            ;;

            render-element)
            opts+=()
            ;;

            service-provider)
            opts+=()
            ;;

            template)
            opts+=()
            ;;

            theme)
            opts+=()
            ;;

            theme-file)
            opts+=()
            ;;

            theme-settings)
            opts+=()
            ;;

            console:dcg-command)
            opts+=()
            ;;

            console:symfony-command)
            opts+=()
            ;;

            entity:bundle-class)
            opts+=()
            ;;

            entity:configuration)
            opts+=()
            ;;

            entity:content)
            opts+=()
            ;;

            form:config)
            opts+=()
            ;;

            form:confirm)
            opts+=()
            ;;

            form:simple)
            opts+=()
            ;;

            misc:apache-virtual-host)
            opts+=()
            ;;

            misc:nginx-virtual-host)
            opts+=()
            ;;

            plugin:action)
            opts+=()
            ;;

            plugin:block)
            opts+=()
            ;;

            plugin:ckeditor)
            opts+=()
            ;;

            plugin:condition)
            opts+=()
            ;;

            plugin:constraint)
            opts+=()
            ;;

            plugin:entity-reference-selection)
            opts+=()
            ;;

            plugin:field:formatter)
            opts+=()
            ;;

            plugin:field:type)
            opts+=()
            ;;

            plugin:field:widget)
            opts+=()
            ;;

            plugin:filter)
            opts+=()
            ;;

            plugin:menu-link)
            opts+=()
            ;;

            plugin:migrate:destination)
            opts+=()
            ;;

            plugin:migrate:process)
            opts+=()
            ;;

            plugin:migrate:source)
            opts+=()
            ;;

            plugin:queue-worker)
            opts+=()
            ;;

            plugin:rest-resource)
            opts+=()
            ;;

            plugin:views:argument-default)
            opts+=()
            ;;

            plugin:views:field)
            opts+=()
            ;;

            plugin:views:style)
            opts+=()
            ;;

            service:access-checker)
            opts+=()
            ;;

            service:breadcrumb-builder)
            opts+=()
            ;;

            service:cache-context)
            opts+=()
            ;;

            service:custom)
            opts+=()
            ;;

            service:event-subscriber)
            opts+=()
            ;;

            service:logger)
            opts+=()
            ;;

            service:middleware)
            opts+=()
            ;;

            service:param-converter)
            opts+=()
            ;;

            service:path-processor)
            opts+=()
            ;;

            service:request-policy)
            opts+=()
            ;;

            service:response-policy)
            opts+=()
            ;;

            service:route-subscriber)
            opts+=()
            ;;

            service:theme-negotiator)
            opts+=()
            ;;

            service:twig-extension)
            opts+=()
            ;;

            service:uninstall-validator)
            opts+=()
            ;;

            test:browser)
            opts+=()
            ;;

            test:kernel)
            opts+=()
            ;;

            test:nightwatch)
            opts+=()
            ;;

            test:unit)
            opts+=()
            ;;

            test:webdriver)
            opts+=()
            ;;

            yml:breakpoints)
            opts+=()
            ;;

            yml:links:action)
            opts+=()
            ;;

            yml:links:contextual)
            opts+=()
            ;;

            yml:links:menu)
            opts+=()
            ;;

            yml:links:task)
            opts+=()
            ;;

            yml:module-info)
            opts+=()
            ;;

            yml:module-libraries)
            opts+=()
            ;;

            yml:permissions)
            opts+=()
            ;;

            yml:routing)
            opts+=()
            ;;

            yml:services)
            opts+=()
            ;;

            yml:theme-info)
            opts+=()
            ;;

            yml:theme-libraries)
            opts+=()
            ;;

            esac

            _describe 'option' opts
        ;;
        *)
            # fallback to file completion
            _arguments '*:file:_files'
    esac
}

compdef _dcg dcg
