Skip to content
New issue

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

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

Already on GitHub? # to your account

Parsing default fix list of values #58

Closed
ollehellman opened this issue Mar 23, 2016 · 5 comments
Closed

Parsing default fix list of values #58

ollehellman opened this issue Mar 23, 2016 · 5 comments
Labels

Comments

@ollehellman
Copy link

Hi,

Sorry to bother you so much. I think I found a bug: running ./test_basic --string hello gives me

...
Integer list inputs:
  Input(1) = +1
  Input(2) = +140308968915872
  Input(3) = +140734567466896
...

Whereas the default values are 1 8 32. If I add --integer_list 1 2 3 everything works fine. I tracked it down, and it seems that the default separator 'args_sep' is not inserted into the default list. I could fix it by replacing

call tokenize(strin=buffer, delimiter=args_sep, toks=vals, Nt=Nv)

with

  if(.not.self%is_passed) then
    call tokenize(strin=buffer, delimiter=' ', toks=vals, Nt=Nv)
  else
    call tokenize(strin=buffer, delimiter=args_sep, toks=vals, Nt=Nv)
  endif

But that is probably not a good way of doing it. I tried figuring out the parse sobroutine, but my brain started hurting when I tried to figure out what to add.

@szaghi
Copy link
Owner

szaghi commented Mar 23, 2016

@ollehellman

You are not bothering at all! Thank you very much, it is absolutely a bug! Unfortunately, test coverage is still poor (70%), thus there are probably a lot of bug. Tomorrow I will fix this.

Thank you again!

@szaghi szaghi added the bug label Mar 23, 2016
@szaghi
Copy link
Owner

szaghi commented Mar 24, 2016

In the new v1.0.2 this should be fixed (with also the cosmetic change you highlighted into issue #57).

I also introduce a (hopefully) nice new feature: the explicit call to cli%parse method is now optional! The first time you call cli%get the parsed status is checked and, if necessary, cli%parse is automatically called. This involves a small API change (fully backward compatible): cli%get now accept also the optional argument args for passing CLAs by string.

See the new added tests test_minimal and test_hidden.

Let me know if this fix the bug also for you.

Cheers.

@ollehellman
Copy link
Author

Hi,

Yes and no. All the defaults are parsed correctly, but now the -h output looks weird:

   --qpoint_grid value#1 value#2 value#3, -qg value#1 value#2 value#3
          default value 26||!||26||!||26

where I would expect

   --qpoint_grid value#1 value#2 value#3, -qg value#1 value#2 value#3
          default value 26 26 26

an easy fix perhaps?

@szaghi
Copy link
Owner

szaghi commented Mar 25, 2016

@ollehellman ops... the weird separators are indeed the internal flap one that are inserted by the new sanitize... it is easy to fix, later today I push a fix. Thank you for your help (you are now mentioned into the official contributors 😄 )

@szaghi
Copy link
Owner

szaghi commented Sep 27, 2016

This should be fixed. @ollehellman feel free to re-open it.

@szaghi szaghi closed this as completed Sep 27, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants