_Docs/
Get StartedModulesPlatformDeployCookbookChangelogReference
_Stack
_Modules
  • Ledger
  • Numscript
    • Program Structure
    • Selecting an Interpreter
    • Unambiguous Monetary Notation
    • CLI
    • Numscript specs format
    • Reference
      • Send
      • Sources
      • Destinations
      • Rounding
      • Save
      • Overdraft
      • Variables
      • Metadata
      • oneofexp
      • Account Interpolationexp
      • get_assetexp
      • get_amountexp
      • Mid-script Function Callsexp
      • Asset Colorsexp
  • Connectivity
  • WalletsEE
  • FlowsEE
  • ReconciliationEE
  1. Modules
  2. Numscript
  3. CLI
Numscript

CLI

Install#

You can install the numscript cli with one of the following ways:

Using curl#

For Mac and Unix:

Shell
curl -sSf https://raw.githubusercontent.com/formancehq/numscript/main/install.sh | bash

Using golang toolchain#

Shell
go install github.com/formancehq/numscript/cmd/numscript@latest

Check#

You can use the numscript check command to run static analysis on a numscript program. The static analysis includes parsing errors, wrong variables or types usage, as well as more advanced checks on numscript constructs.

You can use it this way:

shellscript
numscript check my-file.num

The command will exit with an error status code if there is at least one error or warning.

Run#

Available from numscript@0.0.19

You can use the CLI to run local scripts (mostly intended for local prototyping).

For example, given this script:

Numscript
vars {
  monetary $amt  
}

send $amt (
  source = @alice
  destination = @world
)

And this inputs file (which has to have the same name of the numscript file, plus the .inputs.json suffix):

JSON
{
  "variables": {
    "amt": "USD/2 100"
  },
  "balances": {
    "alice": { "USD/2": 9999 }
  }
}

You can run the file using:

shellscript
numscript run my-script.num

You'll see the postings:

Postings:
| Source | Destination | Asset | Amount |
| alice  | world       | USD/2 | 100    |

Test#

Available from numscript@0.0.19

You can use the numscript test to check that the specs given in a numscript specs format file are valid for a given numscript.

For example:

shellscript
numscript test src/domain/numscript

This will look into all the src/domain/numscript folder to find all the <file>.num that have a corresponding <file>.num.specs.json specs file

Unambiguous Monetary NotationNumscript specs format
On This Page
  • Install
  • Check
  • Run
  • Test