OpenXRay/xray-16

Sparse command line argument parsing with virtually no documentation on arguments

Open

#316 opened on Jan 2, 2019

View on GitHub
 (4 comments) (0 reactions) (0 assignees)C++ (519 forks)auto 404
CoreDocumentationEnhancementHelp wanted

Repository metrics

Stars
 (3,524 stars)
PR merge metrics
 (PR metrics pending)

Description

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)

Contributor guide