mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-22 00:05:24 -06:00
6f646b7a79
Before, this would only return an error if there was no query argument.
However, I've run into this recently, running the erroneous command
opa build -o out.wasm 'data.simplest.allow = x' simplest.rego
which produced no error, the resulting wasm file wasn't what I was
expecting.
With this change, the bad command line would give an error; and might
prompt the user to re-read the usage text and provide the proper command
instead,
opa build -o out.wasm -d simplest.rego 'data.simplest.allow = x'
----
Alternatively to how it's done here, we could have provided the cobra
field
Args: cobra.ExactArgs(1),
but the PreRunE function has a more specific error message. So, I've
taken the message from `opa deps`.
Signed-off-by: Stephan Renatus <srenatus@chef.io>