diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 16:16:14 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 16:16:14 +0100 |
| commit | 632f88fd315626bf3196024f2a67c5288ea56333 (patch) | |
| tree | a041d430ac73cb6d14d61370b168b7ea1c28a2a6 /minishell_test/args.py | |
| parent | 86355a6fd7375f954bf92cb49a14c718610c4d60 (diff) | |
| parent | 820d1ee00975d2e7859e4b2aded88dbf56a3b347 (diff) | |
| download | minishell_test-632f88fd315626bf3196024f2a67c5288ea56333.tar.gz minishell_test-632f88fd315626bf3196024f2a67c5288ea56333.tar.bz2 minishell_test-632f88fd315626bf3196024f2a67c5288ea56333.zip | |
Merge branch 'config'
Diffstat (limited to 'minishell_test/args.py')
| -rw-r--r-- | minishell_test/args.py | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/minishell_test/args.py b/minishell_test/args.py index ef47081..3f56b8c 100644 --- a/minishell_test/args.py +++ b/minishell_test/args.py @@ -6,16 +6,16 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:32 by charles #+# #+# # -# Updated: 2021/02/24 08:48:15 by cacharle ### ########.fr # +# Updated: 2021/02/27 12:08:55 by cacharle ### ########.fr # # # # ############################################################################ # import argparse import textwrap - -import minishell_test.config as config +import functools +@functools.lru_cache(maxsize=1) def parse_args(): """Parse command line arguments""" @@ -25,65 +25,64 @@ def parse_args(): epilog="Made by cacharle - https://cacharle.xyz" ) parser.add_argument( - "-p", "--path", default=config.MINISHELL_DIR, + "-p", "--path", + default=".", help="Path to minishell directory" ) parser.add_argument( - "-l", "--list", action="store_true", + "-l", "--list", + action="store_true", help="Print available test suites" ) parser.add_argument( - "-t", "--try-cmd", metavar="COMMAND", + "-t", "--try", + metavar="COMMAND", + dest='try_cmd', help=textwrap.dedent("""\ Run a custom command like this test would (the only environment variable passed to your executable are TERM and PATH) """) ) parser.add_argument( - "-k", "--check-leaks", action="store_true", + "-k", "--check-leaks", + action="store_true", help="Run valgrind on tests (disable usual comparison with bash)" ) parser.add_argument( - "-r", "--range", nargs=2, type=int, metavar=("BEGIN", "END"), + "-r", "--range", + nargs=2, + type=int, + metavar=("BEGIN", "END"), help="Range of test index to run (imply --show-index)" ) parser.add_argument( - "--show-range", action="store_true", + "--show-range", + action="store_true", help="Show test index (useful with --range)" ) parser.add_argument( - "-x", "--exit-first", action="store_true", + "-x", "--exit-first", + action="store_true", help="Exit on first fail" ) parser.add_argument( - "-v", "--verbose", action="count", - help="Increase verbosity level (e.g -vv == 2)" - ) - parser.add_argument( - "-b", "--bonus", action="store_true", - help="Enable bonus tests" - ) - parser.add_argument( - "-n", "--no-bonus", action="store_true", - help="Disable bonus tests" - ) - parser.add_argument( - "-m", "--make", action="store_true", + "-m", "--make", + action="store_true", help="Make minishell and exit" ) parser.add_argument( - "-g", "--pager", action="store_true", + "-g", "--pager", + action="store_true", help="After running the test, display the result in a pager of your choice" ) parser.add_argument( - "suites", nargs='*', metavar="suite", + "suites", + nargs='*', + metavar="SUITE", help=textwrap.dedent("""\ Test suites/group to run. It tries to be smart and autocomplete the suite name (e.g ./run int -> ./run preprocess/interpolation) """) ) - tmp = parser.parse_args() - if tmp.verbose is None: - tmp.verbose = 1 - return tmp + return parser.parse_args() |
