JaroslawWiosna / regionalizer

How to choose the best capital of a state and regions? Divider into regions, especially for administrative purposes
Mozilla Public License 2.0
2 stars 2 forks source link

"./regionalizer --help" concept introduced #14

Closed JaroslawWiosna closed 7 years ago

JaroslawWiosna commented 7 years ago

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:

  1. FlagParser - logic of argv processing. This class gives us std::map flags
  2. FlagHandling - here we could process the flags object. i.e. when --help is given: print help.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

JaroslawWiosna commented 7 years ago

With f8f3038 there was a conflict. That is why 495b811 was needed.

JaroslawWiosna commented 7 years ago

@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:

  1. FlagHandling is not needed for now.
  2. Let's merge it to master

... what do you say, @kermit10000000 ?