Docopt isn't setting defaults

438 Views Asked by At

I have a bash script that uses docopts. It works beautifully on my Debian machine, but fails to set defaults on my Ubuntu laptop. Here's the docopts code:

eval "$(docopts -A args -V - -h - : "$@" <<EOF
Usage: cmus_select.sh [--list <tag>] [--random] [--structure=</alt/dir/structure>] [--dir=/path/to/music]

  -h --help                Show help
  -r --random              Randomize selection instead of using a dmenu
  -l --list TAG            List music by tag.  Unless you use -s, genre, artist, album, and song are expected. [default: song]
  -s --structure STRUCT    Directory structure for your music.  [default: genre/artist/album/song]
  -d --dir DIR             Location of music [default: $HOME/Music/]
----
cmus_select.sh 0.0.1
EOF
)"
  • I found the two spaces requirement and already checked that (not sure if stackoverflow formatting will eat the spaces.)
  • Both machines use docopts 0.6.1+fix. The debian machine uses bash 4.2.37 and python 2.7.3. The ubuntu machine is on 4.2.45 and 2.7.5+.
  • I tried a variety of ways to describe the options. Different order of -l/--list. = sign between the option and its variable. Var name in angle brackets. Etc. It reliably works in debian and not in Ubuntu.

-- followup--

I encountered the same problem on a debian testing machine. Docopts is looking for a new maintainer so I gave up. As an alternative I wrote https://raw.github.com/sagotsky/.dotfiles/612fe9e5c4aa7e1fae268810b24f8f80960a6d66/scripts/argh.sh which is smaller than docopts but does what I need.

0

There are 0 best solutions below