Skip to content

Commit

Permalink
unix/main: Add --version command-line option.
Browse files Browse the repository at this point in the history
CPython also has this option.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Oct 15, 2024
1 parent 51663b9 commit 838f212
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ports/unix/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 838f212

Please sign in to comment.