EJS(1)                           User Commands                          EJS(1)

NAME
       ejs  -  Interpreted  object-oriented  scripting  language  (Javascript)
       shell.

SYNOPSIS
       ejs  [--class  className]  [--cmd  literalScript]  [--debug]   [--files
       "files..."]  [--log logSpec] [--method methodName] [--nodebug] [--opti-
       mize level] [--search ejsPath] [--standard] [--stats] [--strict] [--use
       'module, ...']  [--version] [--warn level] file [arguments ...]

DESCRIPTION
       The ejs command is an Ejscript command shell that can interpret and run
       JavaScript programs.

       Ejscript is an enhanced implementation of the JavaScript  language  for
       use  in embedded applications such as web servers, embedded devices and
       mobile phones. It is especially well suited for Server-Side  JavaScript
       web applications.

INVOCATION
       The  ejs command can be used as a shell to interactively interpret com-
       mands typed at the console or to run script files. When invoked with no
       files  on  the command line, ejs runs in interactive mode.  In interac-
       tive mode, ejs reads input from the console  and  parses  and  executes
       script code as it is entered. In this mode, ejs command will read input
       until it has a complete block of code and will then execute the  block.
       The last result value computed will be echoed to the console. For exam-
       ple:

       ejs-0> if (true) {
       ejs-2>     print("Hello World");
       ejs-2> }
       Hello World

       ejs-0>

       Note: the input prompt includes a level of nest indicator  starting  at
       zero  and increasing upward as commands nest. This is a hint as to when
       you have closed sufficient braces for ejs to execute your  command.  As
       this  is  an  internal compiler nest value, it will sometimes increment
       more than 1 for each brace.

       If ejs is invoked with a file name on the command line, that file  will
       be  read  and its statements executed. One file may be supplied and the
       arguments after it will be passed into the script as command line argu-
       ments. For example:

               ejs myscript.es arg1 arg2 arg3

       The  given  file  may be either a script file or it may be a previously
       compiled Ejscript module with a .mod extension.

       If you require more script files to be parsed, use the  --files  "files
       ..." switch to supply extra scripts. These will be parsed in order, but
       after the primary script on the command line.

       The ejs command can also invoke a specific static  method  on  startup.
       If  either the --class or --method switches are supplied, then ejs will
       run the requested static method after the input file script  statements
       have been executed.

COMPLIANCE
       Ejscript  is  fully  compliant with the JavaScript (ECMA-262 3.X) stan-
       dards, but it also offers a set of enhancements and fixes  designed  to
       improve  the  language  and correct some longstanding JavaScript design
       issues.

OPTIONS
       --class className
              Use the given className when searching for  the  startup  method
              specified via --method or "main" by default.

       --cmd literalCommand
              Evaluate a literal command string.

       --debug
              Run  in  debug  mode  and  generate symbolic stack backtraces if
              required.

       --files "files ..."
              Specifies an extra set of files to be compiled. The ejs  command
              normally  takes  just  one script file on the command line.  The
              --files switch allows extra script to be compiled after the pri-
              mary script, but before the scripts are run.

       --log logName[:logLevel]
              Specify  a file to log internal execution messages. Ejs will log
              execution related trace to the log file. The log level specifies
              the  desired  verbosity  of output. Level 0 is the least verbose
              and level 9 is the most. Level 2  will  include  trace  of  each
              source  statement  and  assembler instruction executed (provided
              --nodebug is not specifiec).

       ---method methodName
              Set the startup method name. Defaults to "main" if a --className
              is specified and --method is not.

       --nodebug
              Run  the  script  without debug information. This will result in
              exceptions not having symbolic stack backtraces.

       --optimize level
              Set the code optimization level. Level values must be between  0
              (least) and 9 (most). Default is level 9.

       --search ejsPath
              Set  the  module search path. The module search path is a set of
              directories that the ejs command  will  use  when  locating  and
              loading Ejscript modules.  The search path will always have some
              system directories appended to  the  end.  These  include  paths
              specified  via  the  EJSPATH environment variable and key system
              directories such as the Ejscript system module directory and the
              directory containing the ejs command.

              The  search  path  value is similar in format to the system PATH
              variable format.  On windows, path segments are separated by ";"
              and on Linux, Unix, FreeBSD and MAC, the path segments are sepa-
              rated by ":" delimiters.

              Given a module named "a.b.c" in a script, ejs will use the  fol-
              lowing search strategy to locate the module:

              1. Search for a module file named "a.b.c.mod"

              2. Search for a module file named "a/b/c.mod"

              3. Search for a module file named "a.b.c.mod" in the search path

              4. Search for a module file named c.mod in the search path

       --standard
              Run scripts in standard  mode.  Ejscript  supports  two  parsing
              modes: strict and standard. Standard mode does not require vari-
              ables be declared and typed before use.

       --stats
              Print various statistics on exit.

       --strict
              Run scripts in standard  mode.  Ejscript  supports  two  parsing
              modes:  strict and standard. Strict mode requires that all vari-
              ables be declared and typed.

       --use 'module, ...'
              List of modules to preload before compiling input files.

       --warn level
              Set the compiler warning verbosity level. Level values  must  be
              between 0 (least verbose) and 9 (most). Default is 0.

       --version
              Print the ejs command version and exit.

REPORTING BUGS
       Report bugs to dev@embedthis.com.

COPYRIGHT
       Copyright (C) 2004-2010 Embedthis Software.  Ejscript is a trademark of
       Embedthis Software.

SEE ALSO
       ejsc, ejsgen, ejsmod

ejs                               March 2010                            EJS(1)