matejak / argbash

Bash argument parsing code generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Perform argbash arg parsing for bash functions

DryHumorInDC opened this issue · comments

I love argbash for parsing arguments parse via an interactive shell. In addition, I would like to have this same functionality for user-defined functions.

I also have a use case for this.

I often write simple tools or REST API clients as functions in a script. Whenever I need to use that functionality, I source the script and call the functions as needed. Some functions have many optional parameters, so using the positional argument variables for these gets quickly unwieldy, e.g. if you only want to set the last one of six optional parameters, you have to provide values for the other five.

Especially with multiplle small functions, it doesn't seem to make much sense to put each of them in a file, so I was wondering if it's feasible to add the Argbash functionality to functions.

However, I understand if this won't be added because even more code would be generated that bloats the script, or because it would be too much work to implement it properly such that there are no name conflicts.