unix/main: Add command-line -h option for printing help text.

This adds a -h option to print the usage help text and adds a new, shorter
error message that is printed when invalid arguments are given.  This
behaviour follows CPython (and other tools) more closely.
This commit is contained in:
David Lechner
2020-02-01 11:39:18 -06:00
committed by Damien George
parent 5a63bc5a44
commit 83439e38fc
2 changed files with 19 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ Command line options
Usage::
micropython [ -i ] [ -O<level> ] [ -v ] [ -X <option> ] [ -c <command> | -m <module> | <script> ] [ <args> ]
micropython [ -h ] [ -i ] [ -O<level> ] [ -v ] [ -X <option> ] [ -c <command> | -m <module> | <script> ] [ <args> ]
Invocation options:
@@ -38,6 +38,10 @@ interactive REPL mode.
General options:
.. option:: -h
Prints a help message containing the command line usage and exits.
.. option:: -i
Enables inspection. When this flag is set, MicroPython will enter the