Add `print_help` function to nuttx-stm32f4 target
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka
#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;
}
