yq/cmd
Kim Alvefur d302d75c77
Implement basic Lua output support (#1745)
* Implement basic Lua output support

Ref #1700

Basic but working serialization to Lua tables.

* Escape larger set of characters in Lua output

Started with a minimum of replacements, this should be more complete,
tho not all substitutions are strictly required in Lua.

* Print simple keys unquoted in Lua output

String keys that satisfy the requirements for variable names can be used
as keys without quotes in tables.

* Quote Lua keywords in table keys

Keywords are not valid as unquoted keys, thus must be quoted

* Make output of unquoted Lua table keys optional

Generally safer and simpler to not do it.

* Hook up settings for Lua output

* Allow special characters in Lua prefix and suffix

--lua-suffix='});^M' didn't work, so taking this approach instead

* Panic on unhandled YAML Kind in Lua encoder

* Handle YAML case varied booleans in Lua encoder

* Handle special-case numbers in Lua encoder

* Reject unhandled scalar Tags in Lua encoder

* Add note about how Lua nil is unsuitable as table key

Could add some context tracking in the future to allow rejecting nil in
a table key context.

* Return error instead of panic in Lua encoder

* Add initial test for Lua encoder

Boilerplate mostly copied from toml_test.go

* Additional Lua output tests

* Generate Lua encoder documentation

Mostly just for the boilerplate

* Convert octal for Lua output

Lua doesn't have the 0oNNN syntax for octal integers, only decimal and
hexadecimal, hence those can be passed trough as is while octal needs
special treatment.

* Implement indentation in in Lua output

* Respect string Style in Lua encoder

Lua has 'single', "double" and [[ long ]] strings.

* Expand Lua examples

* Output line comments in Lua output

* Implement Lua globals output mode
2023-08-11 12:56:49 +10:00
..
constant.go Add `--nul-output|-0` flag to separate element with NUL character (#1550) 2023-03-29 09:51:55 +11:00
evaluate_all_command.go Add `--nul-output|-0` flag to separate element with NUL character (#1550) 2023-03-29 09:51:55 +11:00
evalute_sequence_command.go Add `--nul-output|-0` flag to separate element with NUL character (#1550) 2023-03-29 09:51:55 +11:00
root.go Implement basic Lua output support (#1745) 2023-08-11 12:56:49 +10:00
shell-completion.go Bump github.com/spf13/cobra from 1.5.0 to 1.6.0 (#1380) 2022-10-17 15:15:19 +11:00
unwrap_flag.go Refactoring 2022-11-10 22:07:53 +11:00
utils.go Implement basic Lua output support (#1745) 2023-08-11 12:56:49 +10:00
version_test.go Clean up cli help doc, add github and doc links 2021-07-09 14:58:09 +10:00
version.go Bumping version 2023-07-12 12:32:14 +10:00