Commit Graph

335 Commits

Author SHA1 Message Date
Mike Farah
1c9f001171 wip 2024-03-12 16:43:53 +11:00
Mike Farah
e092329bf3 String interpolation! #1149 2024-03-05 14:10:12 +11:00
Mike Farah
9adde1ac14 Bumping version 2024-02-26 08:33:29 +11:00
Mike Farah
447bf28cd8 Introduced 'format' to encapsulate encoding and decoding formats together 2024-02-24 16:37:13 +11:00
Mike Farah
1d371b712f Refactoring encoding configuration 2024-02-24 15:59:12 +11:00
Mike Farah
55f6a3a49d Refactoring JSON encoder prefs 2024-02-24 15:48:59 +11:00
Mike Farah
7a01e216c4 Refactoring Yaml encoder prefs 2024-02-24 15:36:16 +11:00
Mike Farah
f44d47a204 Refactoring Props encoder prefs 2024-02-24 15:14:21 +11:00
Mike Farah
2866e90c49 Refactoring XML encoder prefs 2024-02-24 15:03:30 +11:00
Mike Farah
571caa696a Refactoring Output types 2024-02-24 14:58:11 +11:00
Mike Farah
359c4a11b2 Merge branch 'feat/completions' of github.com:scop/yq into scop-feat/completions 2024-02-24 13:48:42 +11:00
Mike Farah
b24b484efc Added --properties-array-brackets flag for properties encoder #1933 2024-02-20 11:39:56 +11:00
Ryan Drew
2865022cf8
Add --properties-separator option (#1951)
This commit adds the --properties-separator option, which lets users
specify the separator used between keys and values in the properties
output format. This is done by adjusting the value of
github.com/magiconair/properties#Properties.WriteSeparator at encode
time.

Some refactoring of the properties encoder unit tests was done to make
it easier to write unit tests that include different separator values.

Fixes: #1864

Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
2024-02-20 10:57:44 +11:00
Mike Farah
9a8151d316 Added csv separator flag #1950 2024-02-17 19:11:41 +11:00
Mike Farah
86bb90f989 Can shebang yq scripts! #1851 2024-02-16 10:48:07 +11:00
Mike Farah
047694546c Bumping version 2024-02-16 09:48:51 +11:00
Mike Farah
3c3f1180d9 Cleaning up log message formats 2024-02-16 09:44:22 +11:00
Mike Farah
9142c93d1b Improved log format 2024-02-16 09:26:31 +11:00
Mike Farah
c32a9ceab8 Added new CSV option to turn off auto-parsing #1947 2024-02-15 13:11:53 +11:00
Mike Farah
bb66c9c872 Bumping version 2024-02-09 10:21:09 +11:00
Mike Farah
e19046273e Bumping version 2024-02-08 13:34:41 +11:00
Ville Skyttä
84890ae34d Add arg and flag completions 2023-12-20 09:36:57 +02:00
Ville Skyttä
a69c1b5230 Generate v2 bash completions
https://github.com/spf13/cobra/blob/main/site/content/completions/_index.md#bash-completion-v2
2023-12-20 09:33:51 +02:00
Mike Farah
dd64899434 Bumping version 2023-12-12 11:35:15 +11:00
Mike Farah
1c3d551060 Bumping version 2023-12-04 11:17:53 +11:00
Mike Farah
779b26310e Updating references to yq being a YAML processor 2023-11-30 15:32:21 +11:00
Mike Farah
c11a53322b Bumping version 2023-11-23 11:59:22 +11:00
Ville Skyttä
eecc106529
Update JSON to YAML example for new JSON input output default (#1875) 2023-11-23 11:54:43 +11:00
Mike Farah
1cf9ecc79d Bumping version 2023-11-18 15:05:29 +11:00
Alessandro Di Stefano
e5cc57bedf
Do not panic when StdIn is closed (#1867)
When the shell executing yq has no open stdin, os.Stdin.Stat() return nil and yq fails to continue. This commit fixes a missing verification on the result of os.Stdin.Stat() in the utils.processStdInArgs function and adds an acceptance test to cover this scenario in the future. This bug affects yq since version 4.26.1.
2023-11-18 12:20:12 +11:00
Mike Farah
79a50b9c20 Fixes dos line separator issue when reading expression file #1860 2023-11-10 09:34:01 +11:00
Mike Farah
5f4c1fbd0a Bumping version 2023-11-08 09:35:43 +11:00
Kim Alvefur
5fa41624c9
Add support for Lua input (#1810) 2023-10-03 16:00:51 +11:00
Mike Farah
a198f72367 Bumping version 2023-09-26 14:48:52 +10:00
-pthread -Wall
05ad1dad90
Fix typos (#1798) 2023-09-26 14:18:18 +10:00
Mike Farah
cdb9b56066 Spellig with cspell 2023-09-19 10:43:11 +10:00
Mike Farah
6609ed76ec Bumping version 2023-08-11 13:53:14 +10:00
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
Mike Farah
0b34c9a00d Bumping version 2023-07-12 12:32:14 +10:00
Mike Farah
5ef537f3fd Bumping version 2023-05-23 13:27:28 +10:00
Giorgio Gallo
80b42b81fd
Implement shell output format (#1645)
* fix typo in a comment

* implement shell output format

* fix a typo

* add two test cases, have source uses ascii only

* add integration tests and documentation

* add fixes after code revieew
2023-05-04 11:06:56 +10:00
Mike Farah
d2f1ae9db7 Bumping version 2023-04-11 12:06:26 +10:00
Mike Farah
eba075294a Added scalar output for TOML (#1617) 2023-04-03 15:40:06 +10:00
Mike Farah
d5bbe5bea5 Bumping version 2023-03-31 10:21:59 +11:00
Valentin Lab
5fd2890d1b
Add `--nul-output|-0` flag to separate element with NUL character (#1550)
This is to ensure solid parsing of complex data (with any binary
content except NUL chars) by separating the `yq` root collection
member's output with NUL char. As a safe-guard, an error will be cast
if trying to use NUL character with content that contains itself NUL
characters inside.
2023-03-29 09:51:55 +11:00
Mike Farah
ebd1548e96 Bumping version 2023-03-26 11:12:36 +11:00
Mike Farah
aebdbb4113 Added warning for auto-input json files 2023-03-26 11:00:05 +11:00
Mike Farah
7103b78d38
Draft: Toml (#1439)
* toml wip

* wip

* Fixed auto parsing toml

* Added build flag not to include toml

* Parse toml docs and tests

* minor updates
2023-03-26 10:59:15 +11:00
Mike Farah
4ee4b09e12 Bumping version 2023-03-20 10:21:49 +11:00
Mike Farah
48b481b68d Unknown file type should default to yaml, Fixes #1609 2023-03-20 09:16:20 +11:00