API-CLI

 view release on metacpan or  search on metacpan

examples/zsh/_digitaloceancl  view on Meta::CPAN

#compdef digitaloceancl

_digitaloceancl() {
    local program=digitaloceancl
    typeset -A opt_args
    local curcontext="$curcontext" state line context


        # ---- Command: 
        _arguments -s  \
            '1: :->cmd1' \
            '*: :->args' \
            && ret=0


        case $state in
        cmd1)
            _alternative 'args:cmd2:((GET\:"GET call" POST\:"POST call" help\:"Show command help"))'
        ;;

        args)
            case $line[1] in
            GET)

                # ---- Command: GET
                _arguments -s -C \
                    '1: :->cmd1' \
                    '2: :->cmd2' \
                    '*: :->args' \
                    && ret=0


                case $state in
                cmd2)
                    _alternative 'args:cmd3:((/account\:"Account information" /droplets\:"List all droplets" /droplets/\\:id\:"Retrieve a droplet by id"))'
                ;;

                args)
                    case $line[2] in
                    /account)

                        # ---- Command: GET /account
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '--data-file[File with data for POST/PUT/PATCH/DELETE requests]:data-file:_files' \
                            '--debug[debug]' \
                            '-d[debug]' \
                            '--verbose[verbose]' \
                            '-v[verbose]' \
                            '--help[Show command help]' \
                            '-h[Show command help]' \
                            && ret=0


                    ;;
                    /droplets)

                        # ---- Command: GET /droplets
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '--data-file[File with data for POST/PUT/PATCH/DELETE requests]:data-file:_files' \
                            '--debug[debug]' \
                            '-d[debug]' \



( run in 0.683 second using v1.01-cache-2.11-cpan-39bf76dae61 )