optparse-applicative with attoparsec parser

Hello, I Try to write a parser for this command line binoculars-ng --debug process data/test/config_sixs_ruche_flymedv_3.ini 698-734 735-736 But I have this problem Invalid argument `735-736' The parser used for this is this one processOptions :: Parser Options processOptions = Process <$> optional config <*> optional (argument (eitherReader (parseOnly configRangeP . pack)) (metavar "RANGE")) it use the configRangeP attoparser parser whcih knows how to deal with the string "698-734 735-736" configRangeP :: Parser ConfigRange configRangeP = ConfigRange <$> (inputRangeP `sepBy` many (satisfy isSep)) where isSep :: Char -> Bool isSep c = c == ' ' || c == ',' the result should be this one Just (ConfigRange [InputRangeFromTo 698 734,InputRangeFromTo 735 736]) so my question how should I fix my processOptions fucntion in order to deal with this problem. thanks for considering Frederic

On Fri, 4 Feb 2022, PICCA Frederic-Emmanuel wrote:
I Try to write a parser for this command line
binoculars-ng --debug process data/test/config_sixs_ruche_flymedv_3.ini 698-734 735-736
But I have this problem
Invalid argument `735-736'
The parser used for this is this one
processOptions :: Parser Options processOptions = Process <$> optional config <*> optional (argument (eitherReader (parseOnly configRangeP . pack)) (metavar "RANGE"))
it use the configRangeP attoparser parser whcih knows how to deal with the string "698-734 735-736"
I guess you must use something like (many (argument ...)).
participants (2)
-
Henning Thielemann
-
PICCA Frederic-Emmanuel