Page MenuHomeWildfire Games

Allow command line options to start with `-` or `--`
ClosedPublic

Authored by Imarok on Sep 7 2017, 2:50 PM.

Details

Summary

Allow command line options to start with - or --.
It was already the case for the version command line option.

Test Plan

Test some command line options like: --version, -version, -replay-visual=somepath and --replay-visual=somepath

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Imarok created this revision.Sep 7 2017, 2:50 PM
Vulcan added a subscriber: Vulcan.Sep 7 2017, 3:38 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jenkins-master:8080/job/phabricator/1990/ for more details.

Vulcan added a comment.Sep 7 2017, 3:39 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jenkins-master:8080/job/phabricator_lint/505/ for more details.

I mostly added both -version and --version so that the former is consistent with the rest of the options, and the latter is consistent with *nix.

I'd prefer if we would switch to -- for all long options (IIRC we don't have any short options) only, but that might require quite some documentation updates.

In D883#35391, @leper wrote:

I mostly added both -version and --version so that the former is consistent with the rest of the options, and the latter is consistent with *nix.

I'd prefer if we would switch to -- for all long options (IIRC we don't have any short options) only, but that might require quite some documentation updates.

What speaks against having both?

Consistency mostly (of examples, command lines by users, etc). Having two equivalent options that do the same might confuse new users. If someone else likes having both I'm not going to object, but I'd prefer one style (and that would be -- for long options, - for short ones (though we don't have any)).

mimo accepted this revision.Sep 20 2017, 8:43 PM
mimo added a subscriber: mimo.

Tested and works as expected.
I don't have strong opinions about keeping both styles or only the "--" for long options, so i'm fine with the patch as it is :)

This revision is now accepted and ready to land.Sep 20 2017, 8:43 PM
This revision was automatically updated to reflect the committed changes.