Commit Graph

68 Commits

Author SHA1 Message Date
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
Valentin Lab
a60d27975a
add tests for root node unwrap bug in previous versions (#1837) 2023-10-23 20:03:51 +11:00
Mike Farah
13d1bbb45f
Generic ast (#1829)
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
2023-10-18 12:11:53 +11:00
Kim Alvefur
7c78a15b23
Lua output fixes (#1811)
* encoder_lua: Handle explicitly positive infinity

* encoder_lua: Fix inclusion of pre-/suffix when prettyPrinted

It seems certain operations like --prettyPrint or subset selections does
not produce a DocumentNode, which is where the lua pre- and suffix was
printed, causing those to be omitted.

* encoder_lua: Improve Tag handling robustness

Using the method call seems more reliable in case the input parser
forgets to set the tag.
2023-10-12 11:25:26 +11: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
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
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
48b481b68d Unknown file type should default to yaml, Fixes #1609 2023-03-20 09:16:20 +11:00
Mike Farah
08a6cb65fe
Auto output format (#1599)
* Use file extension to auto detect output format!

* Use file extension to auto detect output format!

* formatting
2023-03-15 13:22:58 +11:00
ryenus
d30941b575
Detect input format based on file name extension (#1582)
* detect inputFormat from filename

* refactor and extract func InputFormatFromFilename

* detect inputFormat only when file is provided

* add test for automatic input format detection
2023-03-09 10:17:19 +11:00
Mike Farah
83c5e1bc83 Include blank new lines in leading header preprocessing #1462 2022-12-08 13:33:06 +11:00
Mike Farah
762f46ed54 include yaml directives #1424 2022-11-14 17:22:13 +11:00
Mike Farah
88ce6ffcbe Hotfix: actually update the default xml attribute prefix #1428 2022-11-13 11:13:34 +11:00
Mike Farah
1d35134310 Unwrap scalar now works for JSON encoding when explicitly set #1409 2022-11-10 19:21:18 +11:00
Mike Farah
880397d549
Refactored decoder responsibilities (#1402)
- improved comment handling
- yaml decoder now responsible for leading content work around
2022-10-28 14:16:46 +11:00
Mike Farah
6d6b693fb3
Added XML processing instructions and directive support (#1396) 2022-10-24 10:09:42 +11:00
Mike Farah
33ec66cfdd Fixed handling of UTF8 encoded CSVs #1373 2022-10-08 13:12:50 +11:00
Mike Farah
a4b60039ca Added examples of header-preprocess needing to be turned off 2022-09-30 09:36:38 +10:00
Mike Farah
c8815f5ab9
Csv decoder (#1290)
* WIP: adding CSV decoder

* Adding CSV decoder

* Added CSV roundtrip

* Fixing from review
2022-08-01 10:28:34 +10:00
Mike Farah
06d2aaad80 Adding acceptance test for #1257, fixed panic 2022-06-25 12:15:28 +10:00
Mike Farah
dfd396b480 When split expression includes an extension, dont add .yml automatically 2022-06-23 14:31:09 +10:00
Mike Farah
2bc7dcfcca Handle xml namespaces by default 2022-06-15 17:12:57 -07:00
Mike Farah
6bce23d9c2 Improved handling of trailing document comments 2022-05-25 10:54:03 +10:00
Mike Farah
55c5497fab Can specify a split expression file #1194 2022-04-29 11:08:41 +10:00
Mike Farah
70ad7a35a8 Don't automatically read stdin when the null input flag is used 2022-04-27 09:24:25 +10:00
Mike Farah
3ad5355777 Fixes bug when using inplace with no expression and multiple files #1193 2022-04-27 09:08:50 +10:00
Mike Farah
bbeae229ca Disable strict XML parsing by default #1155 2022-03-28 14:05:10 +11:00
Mike Farah
33a29817d7 Can load expressions from file #1120 2022-03-01 11:50:09 +11:00
Mike Farah
304fc462a4 No longer auto-read from STDIN if there are files given (#1115) 2022-02-20 13:15:21 +11:00
whi-tw
4b2b47af48
Fix zsh completion (#1108)
4ec533b introduced a bug which causes the 'hidden' cli parameter
`__complete` to be ignored.

Add a check for this parameter, so that it can pass to `cobra`

Signed-off-by: Tom Whitwell <tom@whi.tw>
2022-02-14 08:03:24 +11:00
Mike Farah
a9c3617b4f
Decoder Properties (#1099)
* Decoder Properties

* Added properties round trip test

* Fixed property decode for github actions

* Refactored XML test to use common functions

* Switched formatScenario parameter order for more readablity
2022-02-10 12:02:53 +11:00
Mike Farah
26356ff4be Added github action fix for parsing xml, updated linter 2022-02-07 11:55:55 +11:00
Mike Farah
06e944dcb6 Added github action fix for parsing xml 2022-02-07 11:26:48 +11:00
Mike Farah
2891c6948d Added expression argument to forcibly set expression if required 2022-02-07 09:27:52 +11:00
Mike Farah
703418d0c4 Automatically add "-" when piping and its missing 2022-02-07 09:09:11 +11:00
Mike Farah
75960c6484 Allow multiple files with no expression 2022-02-07 08:23:53 +11:00
Mike Farah
5ac3c57510 Fixed bug - ignore path expressions that match a directory 2022-02-07 08:04:26 +11:00
Mike Farah
a6fc7aa881 Updating docs 2022-01-28 10:06:25 +11:00
Mike Farah
dedd1ca892 Fixing github build 2022-01-27 15:54:26 +11:00
Mike Farah
01b4917f26 Debug github build 2022-01-27 14:22:01 +11:00
Mike Farah
25e374f4ee Debug github build 2022-01-27 14:00:55 +11:00
Mike Farah
3ba728d40c Working around github strangeness 2022-01-27 13:54:29 +11:00
Mike Farah
8761920f58 Debug github build 2022-01-27 13:24:05 +11:00
Mike Farah
394be5c65a Debug github build 2022-01-27 12:47:06 +11:00
Mike Farah
4ec533bc1b No longer have to specify eval! 2022-01-27 12:07:41 +11:00
Mike Farah
fc276ff450 Smarter behaviour when piping data in with one argument 2022-01-27 10:18:46 +11:00
Mike Farah
ec8ef312ef
Added XML encoding/decoding (#1067)
* Added XML encoding/decoding

* Minor fixes

* Improve yq doc

* Lint
2022-01-15 11:57:59 +11:00
Mike Farah
6763ae6e7b Added xml acceptance tests 2021-12-21 17:05:33 +11:00