Skip to content

Commit 1e24a46

Browse files
committed
🎨 Add --version option to wdcli
1 parent 3e97e4f commit 1e24a46

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎platforms/CLI-Emulator/main.cpp‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
} \
3232
}
3333

34+
void print_version() {
35+
fprintf(stdout, "WARDuino WebAssembly Runtime - " PROJECT_VERSION "\n");
36+
}
37+
3438
void print_help() {
35-
fprintf(stdout, "WARDuino WebAssembly Runtime - " PROJECT_VERSION "\n\n");
39+
print_version();
40+
fprintf(stdout, "\n");
3641
fprintf(stdout, "Usage:\n");
3742
fprintf(stdout, " wdcli <file> [options]\n");
3843
fprintf(stdout, "Options:\n");
@@ -62,6 +67,7 @@ void print_help() {
6267
" --mode The mode to run in: interpreter, proxy "
6368
"(default: interpreter)\n");
6469
fprintf(stdout, " --invoke Invoke a function from the module\n");
70+
fprintf(stdout, " --version Get version information\n");
6571
}
6672

6773
Module *load(WARDuino wac, const char *file_name, Options opt) {
@@ -284,7 +290,10 @@ int main(int argc, const char *argv[]) {
284290
}
285291

286292
ARGV_SHIFT();
287-
if (!strcmp("--help", arg)) {
293+
if (!strcmp("--version", arg)) {
294+
print_version();
295+
return 0;
296+
} else if (!strcmp("--help", arg)) {
288297
print_help();
289298
return 0;
290299
} else if (!strcmp("--loop", arg)) {

0 commit comments

Comments
 (0)