Closed JaroslawWiosna closed 7 years ago
With f8f3038 there was a conflict. That is why 495b811 was needed.
@kermit10000000 ...so I was thinking about new file, like FlagHandling
, which could process the flags object.
Now, I think that new method hasKey
inside FlagParser is enough.
Let's have a look below:
./regionalizer --help -list ../database/some-file.txt
Argv is processed into:
KEYS | VALUES |
---|---|
--help | < no value > |
-list | ../database/some-file.txt |
It doesn't make sense to execute the program by ./regionalizer --help YES-I-WANT-TO-SEE-IT -list ../database/some-file.txt
In fact when --help is given we should print help, so hasKey("--help")
is needed.
My conclusions:
FlagHandling
is not needed for now.... what do you say, @kermit10000000 ?
Basic concept introduced.
I think we could merge it for now ...and quickly we should implement unit test for different argv
...and also "the parsing process" should be moved from
main.cpp
to somewhere else. Perhaps FlagParser class could be a good option. But maybe new file for flag handling would be better. In fact, I think we should separate:FlagParser
- logic of argv processing. This class gives usstd::map flags
FlagHandling
- here we could process theflags
object. i.e. when--help
is given: printhelp.txt
and terminate the program(application)...I am not sure if this is good idea... I would like to know your opinion on that, @kermit10000000