dune-community / dune-xt-common

Other
2 stars 3 forks source link

transition to named options in configs command line parsing #131

Closed ftalbrecht closed 6 years ago

ftalbrecht commented 6 years ago

I know it would break most of current tests but I would really like to be able to pass negative numbers in the long run. Either I am to stupid to correctly escape them or it is currently not possible to pass negative numbers as command line arguments:

./test_linear_transport__1d__implicit__fv - timedlogging.max_info -1 -timedlogging.max_debug -1
terminate called after throwing an instance of 'Dune::RangeError'
  what():  RangeError [readOptions:/home/falbr_01/dune-gdt/dune-common/dune/common/parametertreeparser.cc:148]: last option on command line (-1) does not have an argument

./test_linear_transport__1d__implicit__fv - timedlogging.max_info "-1" -timedlogging.max_debug "-1"
terminate called after throwing an instance of 'Dune::RangeError'
  what():  RangeError [readOptions:/home/falbr_01/dune-gdt/dune-common/dune/common/parametertreeparser.cc:148]: last option on command line (-1) does not have an argument

./test_linear_transport__1d__implicit__fv - timedlogging.max_info '-1' -timedlogging.max_debug '-1'
terminate called after throwing an instance of 'Dune::RangeError'
  what():  RangeError [readOptions:/home/falbr_01/dune-gdt/dune-common/dune/common/parametertreeparser.cc:148]: last option on command line (-1) does not have an argument

./test_linear_transport__1d__implicit__fv - timedlogging.max_info=-1 -timedlogging.max_debug=-1
terminate called after throwing an instance of 'Dune::RangeError'
  what():  RangeError [readOptions:/home/falbr_01/dune-gdt/dune-common/dune/common/parametertreeparser.cc:148]: last option on command line (-timedlogging.max_debug=-1) does not have an argument

Using named options would fix that since something like this should work:

./test_linear_transport__1d__implicit__fv --timedlogging.max_info=-1
tobiasleibner commented 6 years ago

If i read the code in dune-common correctly, passing negative numbers should work. The code you posted above has a whitespace between - and timedlogging.max_info. If that whitespace was not introduced when pasting it in this issue, removing that whitespace should fix it.

ftalbrecht commented 6 years ago

Ah, good catch. Thx!