OpenXRay/xray-16

Sparse command line argument parsing with virtually no documentation on arguments

オープン

#316 opened on 2019/01/02

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)C++ (519 件のフォーク)auto 404
CoreDocumentationEnhancementHelp wanted

Repository metrics

Stars
 (3,524 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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)

コントリビューターガイド