diff --git a/targets/nuttx-stm32f4/jerry_main.c b/targets/nuttx-stm32f4/jerry_main.c index 44bdab760..c438ca91b 100644 --- a/targets/nuttx-stm32f4/jerry_main.c +++ b/targets/nuttx-stm32f4/jerry_main.c @@ -32,6 +32,23 @@ #define JERRY_STANDALONE_EXIT_CODE_OK (0) #define JERRY_STANDALONE_EXIT_CODE_FAIL (1) +/** + * Print usage and available options + */ +static void +print_help (char *name) +{ + jerry_port_console ("Usage: %s [OPTION]... [FILE]...\n" + "\n" + "Options:\n" + " --mem-stats\n" + " --mem-stats-separate\n" + " --show-opcodes\n" + " --log-level [0-3]\n" + "\n", + name); +} /* print_help */ + /** * Read source files. * @@ -187,7 +204,12 @@ int jerry_main (int argc, char *argv[]) for (i = 1; i < argc; i++) { - if (!strcmp ("--mem-stats", argv[i])) + if (!strcmp ("-h", argv[i]) || !strcmp ("--help", argv[i])) + { + print_help (argv[0]); + return JERRY_STANDALONE_EXIT_CODE_OK; + } + else if (!strcmp ("--mem-stats", argv[i])) { flags |= JERRY_INIT_MEM_STATS; }