Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defaults don't work when using short options strings #20

Closed
zbeekman opened this issue Mar 29, 2016 · 2 comments
Closed

Defaults don't work when using short options strings #20

zbeekman opened this issue Mar 29, 2016 · 2 comments

Comments

@zbeekman
Copy link
Collaborator

This may be the same bug as #5 and I think I have found a fix.... but it's possible they are distinct.

./main.sh -f foo -t should populate arg_t with the value parsed from the usage string default. However, opt is set to ?, the help function is called and getopts aborts.

As detailed on this SO post you can actually put getopts into silent mode an explicitly test for missing option arguments. Here is some more info from bash hackers wiki: http://wiki.bash-hackers.org/howto/getopts_tutorial#error_reporting

This technique will allow b3bp to not barf when optional option arguments are missing.

@zbeekman
Copy link
Collaborator Author

OK, after more investigation, I have determined I might be overthinking things here... I think the behavior is currently correct. Double checking, and will reopen if I find otherwise.

@rouson
Copy link
Collaborator

rouson commented Apr 29, 2016

👏 Glad to hear it. That makes sense because I haven't observed any problematic behaviors recently except on occasion when I deviated from the expected syntax of the usage line. Unfortunately, I didn't write down the details of what those deviations were, but in every case, I was able to edit the line and get behavior that seemed non-problematic to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants