xgo/docs/tengo-cli.md

36 lines
937 B
Markdown
Raw Normal View History

2019-01-24 03:30:41 +03:00
# Tengo CLI Tool
Tengo is designed as an embedding script language for Go, but, it can also be compiled and executed as native binary using `tengo` CLI tool.
## Installing Tengo CLI
To install `tengo` tool, run:
```bash
go get github.com/d5/tengo/cmd/tengo
```
2019-01-30 12:05:35 +03:00
Or, you can download the precompiled binaries from [here](https://github.com/d5/tengo/releases/latest).
2019-01-24 03:30:41 +03:00
## Compiling and Executing Tengo Code
You can directly execute the Tengo source code by running `tengo` tool with your Tengo source file (`*.tengo`).
```bash
tengo myapp.tengo
```
Or, you can compile the code into a binary file and execute it later.
```bash
2019-01-30 12:23:26 +03:00
tengo -o myapp myapp.tengo # compile 'myapp.tengo' into binary file 'myapp'
tengo myapp # execute the compiled binary `myapp`
2019-01-24 03:30:41 +03:00
```
## Tengo REPL
You can run Tengo [REPL](https://en.wikipedia.org/wiki/Readevalprint_loop) if you run `tengo` with no arguments.
```bash
tengo
```