unix/main: Add --version command-line option.
CPython also has this option. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -318,6 +318,7 @@ static void print_help(char **argv) {
|
|||||||
printf(
|
printf(
|
||||||
"usage: %s [<opts>] [-X <implopt>] [-c <command> | -m <module> | <filename>]\n"
|
"usage: %s [<opts>] [-X <implopt>] [-c <command> | -m <module> | <filename>]\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
|
"--version : show version information\n"
|
||||||
"-h : print this help message\n"
|
"-h : print this help message\n"
|
||||||
"-i : enable inspection via REPL after running command/module/file\n"
|
"-i : enable inspection via REPL after running command/module/file\n"
|
||||||
#if MICROPY_DEBUG_PRINTERS
|
#if MICROPY_DEBUG_PRINTERS
|
||||||
@@ -369,6 +370,10 @@ static void pre_process_options(int argc, char **argv) {
|
|||||||
print_help(argv);
|
print_help(argv);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
if (strcmp(argv[a], "--version") == 0) {
|
||||||
|
printf(MICROPY_BANNER_NAME_AND_VERSION "; " MICROPY_BANNER_MACHINE "\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
if (strcmp(argv[a], "-X") == 0) {
|
if (strcmp(argv[a], "-X") == 0) {
|
||||||
if (a + 1 >= argc) {
|
if (a + 1 >= argc) {
|
||||||
exit(invalid_args());
|
exit(invalid_args());
|
||||||
|
|||||||
Reference in New Issue
Block a user