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

Flags w/arguments broken when using short+long #3

Open
rootwork opened this issue Oct 18, 2021 · 1 comment
Open

Flags w/arguments broken when using short+long #3

rootwork opened this issue Oct 18, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@rootwork
Copy link
Owner

rootwork commented Oct 18, 2021

boilerplate/options.sh uses getopts, mostly from Schotts' example, with the addition of long versions (e.g. both -t and --time).

While this works with both short and long options in general, it seems to break for short options when the option is more than a boolean and requires an argument (e.g. --time=5 works; -t=5 doesn't).

Other variants I had found worked with space-separated arguments (instead of =) but worked either with short or long options, not both. Another option would be to have no argument-based flags, and only accept these as position-based arguments the way we're doing with videos/markvid.sh and videos/trimvid.sh.

Investigate if there are better solutions.

Scripts this affects (i.e. currently-broken short options with arguments): images/imagedate.sh, images/modimg.sh, videos/fadevid.sh, videos/minsmvid.sh.

@rootwork rootwork added the bug Something isn't working label Oct 18, 2021
@rootwork
Copy link
Owner Author

Update: It seems like in some cases the long option works and the short doesn't, but in other cases it's vice versa. So there's definitely a bug somewhere.

@rootwork rootwork changed the title Short flags w/arguments broken Flags w/arguments broken when using short+long Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant