NovahGithubSource

Command line and project management

Novah comes not only with a compiler but with a whole suite of commands.

$ novah --help
Usage: novah [OPTIONS] COMMAND [ARGS]...

Options:
  -v, --version  show the current version and exit
  -h, --help     Show this message and exit

Commands:
  compile  compile source files
  deps     fetch and store all dependencies for this project
  build    compile the project described by the `novah.json` file
  new      create a Novah project
  run      run the main module if one is defined
  clear    clear the output directory
  apidoc   generate the api documentation for the project
  repl     start a repl for the current project
  ide      run the Novah language server

Project management

To create a new project use novah new <project-name> . A new directory will be created with the project files.

The novah.json file

Inside the project a `novah.json` file will be created describing your project. There you can add maven or git (requires git installed) depencencies, set your source and Java paths, create aliases, define main entry points and add maven repositories. Ex.:

{
    "paths": ["src"],
    "javaPaths": ["src-java"],
    "deps": {
        "com.fasterxml.jackson.core/jackson-databind":
            {"mvn/version": "2.13.0"},
        "github.com/novahlang/novah-json": {"git/version": "main"}
    }
    "main": "main",
    "output": "./output",
    "aliases": {
        "test": {
            "extraPaths": ["test"],
            "main": "test.main"
        }
    },
    "mvn/repos": {
      "central": {"url": "https://mvnrepository.com/repos/central"}
    }
}

Building the project

After the project is created you can setup it with novah deps which will download any dependency and create the necessary directories and files for the project. Now the project is ready to build with novah build or if you want to build and run directly novah run -b

Running the project

With the project built you can now run it with novah run which will execute the main function of the given alias (or the default alias if none is given). For example: novah run -a test will run the main function of the `test` alias, which should be the project's tests. You can create new aliases with additional source paths and main entry points to execute other routines, tests, build steps or setups your project need.

REPL

Novah comes with a basic repl (read eval print loop) for playing around with the language. It can be execute for a project with novah repl.

Novah 0.4.1 repl.

Type :help for a list of commands.

> :help
:help                -> shows this help
:clear               -> resets the repl
:q, ctrl+c           -> quits the repl
:>                   -> starts a multi-line expression or definition
:test <suite>        -> runs the specified test suite using
                        novah.test.runTests
:t, :type <exp>      -> shows the type of the given expression 
import <mod>         -> adds an import to the repl
foreign import <mod> -> adds a foreign import to the repl