Commit Graph

553 Commits

Author SHA1 Message Date
Mike Farah 992fe066aa Improved property conversion docs 2022-02-01 15:34:17 +11:00
Mike Farah b80080a26d Parameterised merge array by key example 2022-02-01 15:11:39 +11:00
Mike Farah 0afb59c65e Tests can have multiple env variables 2022-02-01 14:58:53 +11:00
Mike Farah 535799462f Added eval operator 2022-02-01 14:47:51 +11:00
Mike Farah a6fc7aa881 Updating docs 2022-01-28 10:06:25 +11:00
Mike Farah 3ba728d40c Working around github strangeness 2022-01-27 13:54:29 +11:00
Mike Farah 394be5c65a Debug github build 2022-01-27 12:47:06 +11:00
Mike Farah c3d815998a Auto style when adding to empty maps/arrays 2022-01-27 09:58:13 +11:00
Mike Farah a9e7f669d0 Merged envsubst into env operators 2022-01-27 09:20:53 +11:00
Samuel Cormier-Iijima 8195ff8b9b
Add a new `envsubst` operator to replace environment variables in strings (#1082) 2022-01-25 19:33:30 +11:00
Mike Farah 9b1a7bf451 Added support for adding objects 2022-01-23 11:35:44 +11:00
Mike Farah 6e33132de9 Added support for `*=` 2022-01-22 16:40:17 +11:00
Mike Farah a6c79f3410 Multiply, substract with custom types 2022-01-22 16:12:59 +11:00
Mike Farah 50df792e49 Auto cast for add 2022-01-22 13:17:16 +11:00
Mike Farah 6f24e878aa Updated README, better xml docs 2022-01-22 12:35:33 +11:00
Mike Farah 2526b03d67 Added JSON conversion tests and doc generation 2022-01-21 20:26:19 +11:00
Eng Zer Jun e347090571
refactor: move from io/ioutil to io and os packages (#1068)
* refactor: move from io/ioutil to io and os packages

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* build: update snapcraft `go-channel` to 1.17

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-01-21 19:50:53 +11:00
Mike Farah de0716e875 Tweaking select docs 2022-01-15 18:22:26 +11:00
Mike Farah 21cdbab0d7 Improving select docs (#839) 2022-01-15 18:18:52 +11:00
Mike Farah 8c94a96ee0 New merge flag (n) to only merge in new fields (#1038) 2022-01-15 15:48:34 +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 606ef91cc6 Better fix #1062 (return error instead of panic) 2022-01-14 15:40:24 +11:00
Mike Farah 78b45a3eb0 Fixed #1062 2022-01-14 15:22:55 +11:00
Mike Farah 84ddf1862f Fixed #1048 2022-01-14 14:55:25 +11:00
Mike Farah ca1c5dab59 Can encode in XML! 2021-12-21 16:59:09 +11:00
Mike Farah 2ee9c65bc2 Added global xml prefs for simplicity 2021-12-21 16:52:54 +11:00
Mike Farah 6bcbd873a6 wip 2021-12-21 16:19:27 +11:00
Mike Farah ae8df5ea87 wip 2021-12-21 16:08:37 +11:00
Mike Farah 851a43b9b6 wip 2021-12-21 15:56:08 +11:00
Mike Farah df32baedf1
Added XML decoder (#1044) 2021-12-21 15:02:07 +11:00
Matthieu MOREL 59752fb36d
enable more linters (#1043)
* enable revive linter

* enable gochecknoinits linter

* enable unconvert linter

* enable unparam linter

* enable asciicheck linter

* enable depguard linter

* enable nakedret linter

* enable megacheck linter

* enable nolintlint linter

* enable predeclared linter

* Update go.yml

* Update go.yml
2021-12-21 09:30:08 +11:00
Mike Farah ffd1f022aa Report while filename failed to parse #1030 2021-12-06 17:25:32 +11:00
Mike Farah c17cf82791 Improving docs 2021-12-05 13:03:38 +11:00
Mike Farah b4db4496d5 Improved tips and tricks 2021-12-05 11:12:09 +11:00
Mike Farah 8b04d972f3 Improved error message 2021-12-05 10:58:26 +11:00
Mike Farah e22df34158 Added sort_by operator 2021-12-04 13:54:12 +11:00
Mike Farah 2f05f7390f wip 2021-12-04 13:25:32 +11:00
Mike Farah dba41ffed7 Assignment op no longer clobbers anchor (#1029) 2021-12-03 09:23:24 +11:00
Mike Farah 855b3c4b47 Cleanup test 2021-12-02 20:06:51 +11:00
Mike Farah df5128fa36 Added encoder tests 2021-12-02 20:06:51 +11:00
Mike Farah f62cfe5ec9 Added encoder tests 2021-12-02 20:06:51 +11:00
Mike Farah d0419ceedf Added csv, tsv output formats 2021-12-02 20:06:51 +11:00
Mike Farah 14f8f92b76 Added map, map_values 2021-12-01 10:32:36 +11:00
Mike Farah 54b355bffb Added another test 2021-12-01 09:14:18 +11:00
Mike Farah 1c50ae4e6a Added another test 2021-11-30 13:22:18 +11:00
Mike Farah feb97c9872 Fixed collect op when working with multiple nodes 2021-11-30 13:19:44 +11:00
Rob Ferguson d41b44dc42
Add accessor for the yq logger instance (#1013)
Allow consumers of yqlib to customize the logger instance.

Closes #432

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>

Co-authored-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Co-authored-by: Rob Ferguson <robert.j.ferguson@nasa.gov>
2021-11-30 10:51:49 +11:00
Mike Farah 176fec639d Better merge example 2021-11-29 21:28:25 +11:00
Mike Farah f5f148cadb Better formatting of merge arrays example 2021-11-29 21:06:09 +11:00
Mike Farah 418bd1a806 Added credit for merge by array example 2021-11-29 20:56:04 +11:00
Mike Farah 4c7c0b83aa Better merge array by key example 2021-11-29 20:53:36 +11:00
Mike Farah 51e946e6ff Better merge array by key example 2021-11-29 20:46:12 +11:00
Mike Farah 8c5d1e0252 gci linter 2021-11-26 20:24:21 +11:00
Matthieu MOREL 15d7c9e118 enable misspell linter 2021-11-25 22:01:30 +11:00
Mike Farah 7e09a66b0b Fixing comments 2021-11-24 10:59:19 +11:00
Mike Farah 733e63d1fb Added more tests 2021-11-24 10:16:48 +11:00
Mike Farah b44fecdfa5 Added key operator 2021-11-24 09:57:35 +11:00
Mike Farah 7f629d5e36 Added errorlint to devtools 2021-11-24 09:27:17 +11:00
Matthieu MOREL 8711042c98 enable errorlint linter 2021-11-24 09:14:02 +11:00
Mike Farah 3d620100f8 Improved load doc 2021-11-18 17:34:08 +11:00
Mike Farah a804e7370f Minor improvement on handling front matter 2021-11-16 16:34:39 +11:00
Mike Farah 356eff3b0b wip 2021-11-16 16:21:08 +11:00
Mike Farah 33871bf007 Fixed header preprocessing! 2021-11-14 10:59:50 +11:00
Mike Farah 11b6261e8b remove leading content indicator 2021-11-14 10:59:50 +11:00
Mike Farah 5df71162c9 fixed printer test 2021-11-14 10:59:50 +11:00
Mike Farah 63f54563ea wip 2021-11-14 10:59:50 +11:00
Mike Farah d912d7d178 wip 2021-11-14 10:59:50 +11:00
Mike Farah 0557439765 Update document generation script 2021-11-03 22:37:07 +11:00
Mike Farah de90b3e85e gitbook wip 2021-11-03 22:37:07 +11:00
Mike Farah 08fc058934 Fix JSON encoding removing null #985 2021-10-30 13:37:21 +11:00
Mike Farah 0b2688c0f1 Split printer 2021-10-30 10:04:41 +11:00
Mike Farah 65fd001575 Improving docs 2021-10-28 09:15:28 +11:00
Mike Farah d508ac3fa4 Fixed flatten error message 2021-10-26 15:43:43 +11:00
Mike Farah 80084e89cc Added flatten operator 2021-10-26 15:42:25 +11:00
Mike Farah 2491051fd9 Added group_by operator 2021-10-26 15:13:26 +11:00
Mike Farah d390fdc641 better docs 2021-10-26 14:33:57 +11:00
Mike Farah 91717b3c5d Can specify indent in encode ops 2021-10-24 11:35:40 +11:00
Mike Farah 587af7f722 Fixed newline handling in encoder/decoder 2021-10-22 15:21:01 +11:00
Mike Farah a1af1b95d0 better docs 2021-10-22 14:55:58 +11:00
Mike Farah b1e64a0d80 Fixed newline handling when decoding/encoding 2021-10-22 14:53:39 +11:00
Mike Farah 7288d34778 Added decoder op 2021-10-22 12:37:47 +11:00
Mike Farah cdc5ef7b15 Added encoder op 2021-10-22 12:00:47 +11:00
Mike Farah 5819dd0853 Fixed expression parsing bug #970 2021-10-18 11:47:03 +11:00
Mike Farah 0064b68ed9 Revert "Removed leadingContentPreProcessing flag - header preprocessing is stable"
This reverts commit 4ce9433468.
2021-10-15 11:47:00 +11:00
Mike Farah e741e6d52f Man page wip 2021-10-15 10:39:33 +11:00
Mike Farah 948399f163 Man page wip 2021-10-15 09:59:08 +11:00
Mike Farah 0436b77d91 Man page wip 2021-10-15 09:51:42 +11:00
Mike Farah 4ce9433468 Removed leadingContentPreProcessing flag - header preprocessing is stable 2021-10-15 08:53:00 +11:00
Peter Matseykanets dd259b4957 Make deepMatch report in linear time
The current implementation of the deepMatch() has the exponential runtime.
Given the long enough input and the pattern with multiple wildcards
it takes a while if ever to complete which can potentially be used
maliciously to cause a denial of service (cpu and memory consumption).

E.g. running this in the root of this repository
time yq eval '.jobs.publishDocker.steps.[] | select (.run == "****outputs")' .github/workflows/release.yml
gives on my laptop
25.11s user 0.06s system 99% cpu 25.182 total

Whereas the updated implementation gives
0.01s user 0.01s system 36% cpu 0.049 total

There are numerous similar CVEs reported for glob evaluation in
different shells/ftp-servers/libraries.

The replacement implementation with the linear runtime is shamelessly taken
verbatim from the briliant article by Russ Cox https://research.swtch.com/glob
2021-10-14 18:45:25 +11:00
Mike Farah ed4d888bfa Speed up multiply 2021-10-11 14:46:46 +11:00
Mike Farah 79bc1f95cb Slight performance improvement to context.ChildContext 2021-10-11 12:56:27 +11:00
Mike Farah 4a4aae00af Sped up explode operator 2021-10-11 10:41:15 +11:00
Mike Farah 839f795710 Fixed select bug (#958) 2021-10-07 15:04:36 +11:00
Mike Farah 43e40a6dda Updating with documentation 2021-09-16 10:55:26 +10:00
Mike Farah 2292f0ffb4 Fixed with semicolon space issue 2021-09-15 22:24:03 +10:00
Mike Farah 2db8140d7f Added contains operator 2021-09-15 15:18:10 +10:00
Mike Farah 084a0f6f1e Merge branch 'subtract' 2021-09-12 21:59:07 +10:00
Mike Farah 6002604251 Added with operator 2021-09-12 21:52:02 +10:00
Mike Farah b2ee131a4c Updated var to work like jq #934 2021-09-12 16:55:55 +10:00
Mike Farah 1cfbbde796 Added missing closing bracket error check 2021-09-12 15:49:50 +10:00