mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
Print help message on startup
This commit is contained in:
@@ -16,6 +16,8 @@ import (
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
|
||||
"github.com/peterh/liner"
|
||||
)
|
||||
|
||||
@@ -64,6 +66,11 @@ func (r *REPL) Loop() {
|
||||
line.SetMultiLineMode(true)
|
||||
r.loadHistory(line)
|
||||
|
||||
fmt.Fprintf(r.output, "OPA %v (commit %v, built at %v)\n", version.Version, version.Vcs, version.Timestamp)
|
||||
fmt.Fprintf(r.output, "\n")
|
||||
fmt.Fprintf(r.output, "Run 'help' to see a list of commands.\n")
|
||||
fmt.Fprintf(r.output, "\n")
|
||||
|
||||
for true {
|
||||
|
||||
input, err := line.Prompt(r.getPrompt())
|
||||
@@ -148,6 +155,8 @@ func (r *REPL) cmdHelp() bool {
|
||||
note string
|
||||
}{
|
||||
{"<stmt>", "evaluate the statement"},
|
||||
{"package <term>", "change currently active package"},
|
||||
{"import <term>", "add import to currently active module"},
|
||||
{"json", "set output format to JSON"},
|
||||
{"pretty", "set output format to pretty"},
|
||||
{"dump", "dump the raw storage content"},
|
||||
|
||||
Reference in New Issue
Block a user