matejak / argbash

Bash argument parsing code generator
Other
1.4k stars 62 forks source link

Generating DocOpt results in incorrect command name #96

Closed EdwardOst closed 4 years ago

EdwardOst commented 5 years ago

I am new to argbash, so perhaps I am doing something wrong. I generate a sample script and m4 specification with the argbash-init command in fully decoupled mode.

argbash-init -s -s --mode=full --pos positional-arg --opt option --opt-bool print myscript

I run argbash to create the parsing library.

argbash --strip user-content "myscript-parsing.m4" -o "myscript-parsing.sh"

I then generate the DocOpts.

argbash --type docopt --strip all myscript-parsing.m4

The resulting docopts references the myscript-parsing rather than myscript.

argbash --strip all --type docopt myscript2-parsing.m4

Usage: myscript2-parsing [--option OPTION] [--print] [--help] <positional-arg>

Options:
  --option OPTION.
  --print           [default: off].
  -h, --help       Prints help.

The expected docopts should reference myscript rather than myscript-parsing

matejak commented 4 years ago

Indeed, you have discovered that the docopt output doesn't work in the fully decoupled mode. Unfortunatelly, I can't imagine a fix, as the decoupling makes quite difficult to reconstruct the link between myscript and the parsing script/template.

The only fix possible is documenting this as a known issue.