~nesv/govern

fa172e1313fa05b4c1bd72d6e808123da5ec02ed — Nick Saika 1 year, 6 months ago 8d8a0d5 wiki
index: Add detail about the Lua shell

This should either be moved to its own page, or included in some proper
documentation.
1 files changed, 39 insertions(+), 1 deletions(-)

M index.md
M index.md => index.md +39 -1
@@ 9,4 9,42 @@ Govern is a configuration management tool.
# Guides

* Writing a runner
* 

# The Lua Shell

Govern comes with a Lua shell!
While this is not necessarily something you may use on a daily basis, it is a
helpful little tool to let you write and debug runners and facts.

To start the shell, run:

```sh
govern -f path/to/config.hcl shell
```

When the shell starts, you will be greeted with a banner, and a govern shell
prompt:

```
govern->
```

From here, you have access to a fully-fledged Lua 5.1 (5.2-ish) shell.

## Loading the `govern` module

All of the govern-specific functions are kept in the `govern` module.
To load this module in the shell, and make use of it, run:

```lua
g = require("govern")
```

`g` is the local name we have given to the module.

The following functions are available:

* `GetFact(string) -> string` — Provided the name of a fact, will return
  the value for that fact.
* `AvailableFacts() -> table` — Returns a table where each value is the
  name of the available, discovered facts on the system.