Usage

Modes

You can run the Numbat command-line application in three different modes:

ModeCommand to run
Start an interactive session (REPL)numbat
Run a Numbat programnumbat script.nbt
Evaluate a single expressionnumbat -e '30 km/h -> mi/h'

Command-line options

See numbat --help for more information.

Interactive sessions

Interactive sessions allow you to perform a sequence of calculations. You can use the special identifiers ans or _ to refer to the result of the last calculation. For example:

>>> 60 kW h / 150 kW

    = 0.4 h

>>> ans -> minutes

    = 24 min

Commands

There is a set of special commands that only work in interactive mode:

CommandAction
list, lsList all functions, dimensions, variables and units
list <what>Where <what> can be functions, dimensions, variables, units
info <identifier>Get more information about units and variables
clearClear screen
help, ?View short help text
quit, exitQuit the session

Key bindings

In interactive command-line mode, you can use the following key bindings. Most importantly, Tab for auto-completion, arrow keys and Ctrl-R for browsing the command history, and Ctrl-D for exiting the interactive session.

Key sequenceAction
Tab, Ctrl-IAuto-completion
Ctrl-DQuit
Ctrl-LClear screen
Up, DownBrowse command history
Ctrl-RSearch command history
Ctrl-CClear the current line
Alt-EnterInsert newline
Home, Ctrl-AMove cursor to the beginning of the line
End, Ctrl-EMove cursor to the end of the line
Ctrl-WDelete word leading up to cursor