]> granicus.if.org Git - graphviz/commitdiff
implement '--help' as an alias for '-?'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 6 Jan 2023 06:01:00 +0000 (22:01 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 8 Jan 2023 01:56:51 +0000 (17:56 -0800)
Gitlab: closes #1618
Reported-by: Basile Starynkevitch <basile@starynkevitch.net>
CHANGELOG.md
lib/common/input.c
tests/test_regression.py

index 795e9e23bf88998a61cba107c38b7bf8c3abc4a2..5e7a67ad2738a7db074d77a0b73d37e72f6fecc0 100644 (file)
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
+- The command line option `--help` has been added as an alias for `-?`. #1618
 - The command line option `--version` has been added as an alias for `-V`. #1618
 
 ### Fixed
index d1e7591df526337497c310416603d6f0613b1a94..f40bc510392640f19b03458cee4969228b8851d2 100644 (file)
@@ -277,6 +277,9 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
                    gvc->common.info[1], gvc->common.info[2]);
            if (GvExitOnUsage) graphviz_exit(0);
            return 1;
+       } else if (argv[i] &&
+           (startswith(argv[i], "-?") || strcmp(argv[i], "--help") == 0)) {
+           return dotneato_usage(0);
        } else if (argv[i] && argv[i][0] == '-') {
            rest = &argv[i][2];
            switch (c = argv[i][1]) {
@@ -408,9 +411,6 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
            case 'y':
                Y_invert = TRUE;
                break;
-           case '?':
-               return (dotneato_usage(0));
-               break;
            default:
                agerr(AGERR, "%s: option -%c unrecognized\n\n", gvc->common.cmdname,
                        c);
index d0da09a003d4b9584c02b6d7cd4d32abf3533f94..88f25834933c7cae3f49c82bd79eb9487c96e3b5 100644 (file)
@@ -601,8 +601,7 @@ def test_1594():
   assert "line 3:" in stderr, \
     "GVPR did not identify correct line of syntax error"
 
-@pytest.mark.parametrize("long,short", (pytest.param("--help", "-?",
-                                        marks=pytest.mark.xfail(strict=True)),
+@pytest.mark.parametrize("long,short", (("--help", "-?"),
                                         ("--version", "-V")))
 def test_1618(long: str, short: str):
   """