OpenXRay/xray-16

Sparse command line argument parsing with virtually no documentation on arguments

Aperta

#316 aperta il 2 gen 2019

 (4 commenti) (0 reazioni) (0 assegnatari)C++ (519 fork)auto 404
CoreDocumentationEnhancementHelp wanted

Metriche repository

Star
 (3524 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

The engine has many commandline arguments, but they all are parsed "in place" by using strstr.

Can we create a single struct with all the flags and params pre-parsed?

This may require additional dependency or even code generation tool to make it work efficiently, but will give us well documented cmd arguments and will concentrate all the parsing in one place, will make code more clear.

Pros:

  • no arguments-related strstr calls in code -> clear code and no ambiguity (i. e. when you have something like this: ./xr_3da -fsltx ../blablabla-globus/fsgame.ltx this will trigger -gl option on windows which may cause unwanted behavior)
  • documentation for arguments and --help option can be easily implemented
  • this may be efective in some usecases of strstr-based parsing

Cons:

  • This will require many lines of dull copy-paste code which we'll have to support
  • or to add another dependency (which also will not be as efficient as just a struct with fields)
  • or to use code-generation tool (which may bring more problems)

Guida contributor