From a66286f3a0f24985cae2648102e51de64b8a1871 Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 6 Apr 2021 20:40:31 +0200 Subject: unix: Improve command line argument processing. Per CPython everything which comes after the command, module or file argument is not an option for the interpreter itself. Hence the processing of options should stop when encountering those, and the remainder be passed as sys.argv. Note the latter was already the case for a module or file but not for a command. This fixes issues like 'micropython myfile.py -h' showing the help and exiting instead of passing '-h' as sys.argv[1], likewise for '-X ' being treated as a special option no matter where it occurs on the command line. --- tests/cmdline/repl_inspect.py | 2 +- tests/cmdline/repl_inspect.py.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/cmdline/repl_inspect.py b/tests/cmdline/repl_inspect.py index 5a7564a3c..8c86f287d 100644 --- a/tests/cmdline/repl_inspect.py +++ b/tests/cmdline/repl_inspect.py @@ -1,2 +1,2 @@ -# cmdline: -c print("test") -i +# cmdline: -i -c print("test") # -c option combined with -i option results in REPL diff --git a/tests/cmdline/repl_inspect.py.exp b/tests/cmdline/repl_inspect.py.exp index 59f734b2f..051acfd15 100644 --- a/tests/cmdline/repl_inspect.py.exp +++ b/tests/cmdline/repl_inspect.py.exp @@ -1,6 +1,6 @@ test MicroPython \.\+ version Use \.\+ ->>> # cmdline: -c print("test") -i +>>> # cmdline: -i -c print("test") >>> # -c option combined with -i option results in REPL >>> -- cgit v1.2.3