Skip to content

Instantly share code, notes, and snippets.

@buu700
Created October 2, 2020 17:07
Show Gist options
  • Save buu700/72d0461d318bfe8c11e36d2316882b2a to your computer and use it in GitHub Desktop.
Save buu700/72d0461d318bfe8c11e36d2316882b2a to your computer and use it in GitHub Desktop.
argbash function
parseArgs () {
argbash-init "${@}" - |
argbash - |
tr '\n' '' |
perl -pe 's/.*START OF CODE GENERATED BY Argbash(.*)END OF CODE GENERATED BY Argbash.*/#$1/g' |
tr '' '\n'
}
@matejak
Copy link

matejak commented Oct 5, 2020

The Argbash quasi-interpreter link goes to docopts ...

I have fixed the link. It leads to an Argbash issues that links to the prototype implementation.

I think that I am slowly starting to see your point - you don't like the generated code in your script.
Therefore, I think that the "interpreter" is the best option for you - instead of calling that function, you could declare the interface in a standard Argbash way, i.e. using comments, which is more descriptive, and you get support for additional goodies s.a. short options, default values, help and manpage output, while the "interpreter" will add the generated code for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment