You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I've been banging my head on this for about an hour. This is not my first attempt at getting docopt working on a stupid shell script. No matter what I do, the eval docopts line thinks -h is one of the args and spits out a help message.
I copied
#!/bin/sh ## rock 0.1.0## Copyright (C) 200X Thomas Light## License RIT (Robot Institute of Technology)## This is free software: you are free to change and redistribute it.## There is NO WARRANTY, to the extent permitted by law.### Usage: rock [options] <argv>...###### --help Show help options.### --version Print program version.
help=$(grep "^### ""$0"| cut -c 5-)
version=$(grep "^## ""$0"| cut -c 4-)eval"$(docopts -h "$help" -V "$version":"$@")"forargin"${argv[@]}";doecho"$arg"done
from the example. It broke in the same way. When I switched to the heredoc example, it worked without issue.
The text was updated successfully, but these errors were encountered:
It's because of the line between the usage pattern and the options. There is a space in my README source code after the last hash sign, but naturally enough it gets dropped during the translations from reStructedText to HTML or a man page screen. So the grep for ^### doesn't catch it, and there isn't a blank line after the usage pattern, and docopt doesn't know what to do.
Thanks for bringing this up. I'll fix up the example so it's less fragile to whitespace hijinks.
Hi. I've been banging my head on this for about an hour. This is not my first attempt at getting docopt working on a stupid shell script. No matter what I do, the eval docopts line thinks -h is one of the args and spits out a help message.
I copied
from the example. It broke in the same way. When I switched to the heredoc example, it worked without issue.
The text was updated successfully, but these errors were encountered: