Skip to content

Separating different positional arguments #72

@musjj

Description

@musjj

I'm trying to separate positional arguments from extra arguments, like this:

#!/usr/bin/env bash

help="
  Usage:
    cli [<args>...] [--] [<extra-args>...] 
"

docopts --no-declare -A args -h "$help" : "$@"

But running ./cli.sh pos -- extra will print this:

args['--']=false
args['<args>,0']='pos'
args['<args>,1']='--'
args['<args>,2']='extra'
args['<args>,#']=3
args['<extra-args>,#']=0

All of the positional arguments are consumed by <args>. How do I separate them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions