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

Long-form invalid arguments aren't caught #48

Open
gdevenyi opened this issue Aug 16, 2016 · 3 comments
Open

Long-form invalid arguments aren't caught #48

gdevenyi opened this issue Aug 16, 2016 · 3 comments

Comments

@gdevenyi
Copy link
Contributor

gdevenyi commented Aug 16, 2016

Example:

read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered
  -s --subject     [arg] Specific subject files to process.
  -v --verbose           Enable verbose mode for all scripts.
  -d --debug             Enables debug mode.
  -h --help              This help page.
  -n --dry-run           Don't submit any jobs.
  -r --reg-command [arg] Provide an alternative registration command. Default="mb_register.sh"
  -f --factor      [arg] Scaling factor for time and memory estimates. Default="1.15"
EOF
read -r -d '' __helptext <<-'EOF' || true # exits non-zero when EOF encountered
  MAGeTBrain implementation using ANTs
  Supports MINC and NIFTI input files (ANTs must be built with MINC support)
  Invocation: mb.sh [options] -- [stage 1] [stage 2] ... [stage N]
  Standard stages: template, subject, resample, vote, run (template, subject, resample, vote)
  Multiatlas stages: multiatlas-resample, multiatlas-vote, multiatlas (template, multiatlas-resample, multiatlas-vote)
  Other stages: init, status, cleanup
  Multiple commands will run multiple stages. Order is not checked.
EOF

User tried to do:

$ mb.sh --template
#Instead of
$ mb.sh -- template

There was no error thrown for the invalid command-line option "--template"

@kvz
Copy link
Owner

kvz commented Aug 17, 2016

Throwing on that would have to be opt-in I feel, as I could imagine use cases where the argument is unknown / passed on to something else

@gdevenyi
Copy link
Contributor Author

Sure, I'm okay with that, just not what I expected from default parsers in other languages.

@zbeekman
Copy link
Collaborator

Yes, I think Open coarrays build script passed arguments to other scripts, only some of which are actually consumed. Been meaning to add an opt-in check for invalid flags.

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

3 participants