diff --git a/examples/data.lua b/examples/data.lua new file mode 100644 index 00000000..c4051e9c --- /dev/null +++ b/examples/data.lua @@ -0,0 +1,9 @@ +return { + ["country"] = "Australia"; -- this place + ["cities"] = { + "Sydney", + "Melbourne", + "Brisbane", + "Perth", + }; +}; \ No newline at end of file diff --git a/pkg/yqlib/decoder_lua.go b/pkg/yqlib/decoder_lua.go index 5db879f4..efc04eac 100644 --- a/pkg/yqlib/decoder_lua.go +++ b/pkg/yqlib/decoder_lua.go @@ -1,3 +1,5 @@ +//go:build !yq_nolua + package yqlib import ( diff --git a/pkg/yqlib/encoder_lua.go b/pkg/yqlib/encoder_lua.go index a74c68cb..d1bb81aa 100644 --- a/pkg/yqlib/encoder_lua.go +++ b/pkg/yqlib/encoder_lua.go @@ -1,3 +1,5 @@ +//go:build !yq_nolua + package yqlib import ( diff --git a/pkg/yqlib/lua_test.go b/pkg/yqlib/lua_test.go index 4089308f..ddcbd023 100644 --- a/pkg/yqlib/lua_test.go +++ b/pkg/yqlib/lua_test.go @@ -1,3 +1,5 @@ +//go:build !yq_nolua + package yqlib import ( @@ -54,6 +56,7 @@ cities: description: "Basic roundtrip", skipDoc: true, scenarioType: "roundtrip", + expression: `.cities[0] = "Adelaide"`, input: `return { ["country"] = "Australia"; -- this place ["cities"] = { @@ -67,7 +70,7 @@ cities: expected: `return { ["country"] = "Australia"; ["cities"] = { - "Sydney", + "Adelaide", "Melbourne", "Brisbane", "Perth", diff --git a/pkg/yqlib/no_lua.go b/pkg/yqlib/no_lua.go new file mode 100644 index 00000000..05368eff --- /dev/null +++ b/pkg/yqlib/no_lua.go @@ -0,0 +1,11 @@ +//go:build yq_nolua + +package yqlib + +func NewLuaEncoder(prefs LuaPreferences) Encoder { + return nil +} + +func NewLuaDecoder(prefs LuaPreferences) Decoder { + return nil +} diff --git a/project-words.txt b/project-words.txt index cbea0767..ab50a416 100644 --- a/project-words.txt +++ b/project-words.txt @@ -155,6 +155,7 @@ Nonquoting nosec notoml noxml +nolua nullinput onea Oneshot diff --git a/scripts/build-small-yq.sh b/scripts/build-small-yq.sh index 81c78c11..9ecfddab 100755 --- a/scripts/build-small-yq.sh +++ b/scripts/build-small-yq.sh @@ -1,2 +1,2 @@ #!/bin/bash -go build -tags yq_notoml -tags yq_noxml -tags yq_nojson -ldflags "-s -w" . \ No newline at end of file +go build -tags "yq_nolua yq_notoml yq_noxml yq_nojson" -ldflags "-s -w" . \ No newline at end of file