diff options
| author | Damien George <damien@micropython.org> | 2024-09-26 18:03:10 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-10-15 14:44:10 +1100 |
| commit | 838f21298ac5a6515d77ce4e4a1b627c8574125f (patch) | |
| tree | 05d536bb736f800eece2147f13abc435d36d1b80 | |
| parent | 51663b9aa71e40bbb3e82bde4918f03adb35ff62 (diff) | |
unix/main: Add --version command-line option.
CPython also has this option.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/unix/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c index e732105c7..58fa3ff58 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -318,6 +318,7 @@ static void print_help(char **argv) { printf( "usage: %s [<opts>] [-X <implopt>] [-c <command> | -m <module> | <filename>]\n" "Options:\n" + "--version : show version information\n" "-h : print this help message\n" "-i : enable inspection via REPL after running command/module/file\n" #if MICROPY_DEBUG_PRINTERS @@ -369,6 +370,10 @@ static void pre_process_options(int argc, char **argv) { print_help(argv); 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 (a + 1 >= argc) { exit(invalid_args()); |
