natelandau / shell-scripting-templates

Shell scripting utility functions and a bash script boilerplate template

Home Page:http://natelandau.com/boilerplate-shell-script-template/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order of arguments and options

ivomarino opened this issue · comments

Hi there, first of all thanks for this great framework, really well done. I just have a question to an use case I have.
I created a new script, let's call it foo, where I pass arguments and options.

This works fine as expected:

➜  ./foo --myvalue=test ssh 
[   info] test
ssh

This not:

➜  ./foo ssh --myvalue=test 
[   info] false
ssh

I'd like to be able to put argument ssh both before the options and also the other way round, this probably means switching $1 with $2 when need here. Any suggestions on how this could be implemented in a clean way? Thanks;)