Commit Graph

380 Commits

Author SHA1 Message Date
Mike Farah
2be0094729 Bumping version 2026-02-01 09:19:54 +11:00
Mike Farah
3d918acc2a Bumping version 2026-01-31 15:03:32 +11:00
jfenal
78192a915b
feat: Add --yaml-compact-seq-indent / -c flag for compact sequence indentation (#2583)
Adds a new CLI flag that enables compact sequence indentation where '- ' is
considered part of the indentation. This leverages the CompactSeqIndent()
method from the underlying go.yaml.in/yaml/v4 library.

Example output with --yaml-compact-seq-indent:
  parent:
    items:
    - one
    - two

Instead of the default:
  parent:
    items:
      - one
      - two

Closes #1841
2026-01-31 14:50:01 +11:00
Flint Winters
f98028c925
Unwrap scalars in shell output mode. (#2548)
* feat: Add UnwrapScalar to ShellVariablesPreferences

- Add UnwrapScalar boolean field to ShellVariablesPreferences struct.
- Initialize UnwrapScalar to false in NewDefaultShellVariablesPreferences.
- This preference will control whether shell output should be quoted or raw.

* feat: Propagate unwrapScalar to ShellVariablesPreferences

- In configureEncoder function, set UnwrapScalar in ConfiguredShellVariablesPreferences.
- This ensures the -r flag's state is passed to the shell encoder for raw output control.

* feat: Implement conditional quoting in shellVariablesEncoder

- Modify doEncode method to check pe.prefs.UnwrapScalar.
- If UnwrapScalar is true, output raw node.Value.
- Otherwise, use quoteValue for shell-safe quoting.
- This enables quote-free output for Kubernetes workflows when -r is used.

* test: Add tests for UnwrapScalar in shell encoder

- Introduce assertEncodesToUnwrapped helper function.
- Add TestShellVariablesEncoderUnwrapScalar to verify quote-free output with -r.
- Add TestShellVariablesEncoderDefaultQuoting to confirm default quoting behavior without -r.
- Ensure comprehensive testing of conditional quoting logic for shell output.

* remove redundant test
2026-01-01 15:21:55 +11:00
Robin H. Johnson
c6029376a5
feat: K8S KYAML output format support (#2560)
* feat: K8S KYAML output format support

Reference: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cli/5295-kyaml/README.md
Co-authored-by: Codex <codex@openai.com>
Generated-with: OpenAI Codex CLI (partial)
Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>

* build: gomodcache/gocache should not be committed

Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>

* chore: fix spelling of behaviour

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

* build: pass GOFLAGS to docker to support buildvcs=false

In trying to develop the KYAML support, various tests gave false
positive results because they made assumptions about Git functionality
Make it possible to avoid that by passing GOFLAGS='-buildvcs=false' to
to Makefile.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

* doc: cover documentScenarios for tests

Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>

* build: exclude go caches from gosec

Without tuning, gosec scans all of the vendor/gocache/gomodcache, taking
several minutes (3m35 here), whereas the core of the yq takes only 15
seconds to scan.

If we intend to remediate upstream issues in future; add a seperate
target to scan those.

Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>

---------

Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Co-authored-by: Codex <codex@openai.com>
2026-01-01 15:14:53 +11:00
Mike Farah
4973c355e6 Bumping version 2025-12-20 19:21:32 +11:00
Mike Farah
4a06cce376
Switch to uk (#2557)
* Setting golangci to UK english (that's what we use in AU)

* Fixing more spelling

* Fixing

* Include MD files in spell checker
2025-12-20 19:11:48 +11:00
Mike Farah
1338b521ff Colours! 2025-12-14 19:41:45 +11:00
Mike Farah
065b200af9 Bumping version 2025-12-14 17:07:57 +11:00
Mike Farah
554bf5a2f2 colorise output 2025-12-08 20:30:47 +11:00
Mike Farah
7ccaf8e700 Bumping version 2025-11-25 10:45:39 +11:00
Mike Farah
45be35c063 Bumping version 2025-11-22 14:52:48 +11:00
Mike Farah
f00852bc6c Added flags to disable env and file ops #2515 2025-11-22 09:40:03 +11:00
Mike Farah
796317b885 Bumping version 2025-11-15 14:32:46 +11:00
Robert Lee
1f2b0fe76b Add --shell-key-separator flag for customizable shell output format
- Add ShellVariablesPreferences struct with KeySeparator field (default: '_')
- Update shellVariablesEncoder to use configurable separator
- Add --shell-key-separator CLI flag
- Add comprehensive tests for custom separator functionality
- Update documentation with example usage for custom separator

This feature allows users to specify a custom separator (e.g. '__') when
outputting shell variables, which helps disambiguate nested keys from
keys that contain underscores in their names.

Example:
  yq -o=shell --shell-key-separator='__' file.yaml

Fixes ambiguity when original YAML keys contain underscores.
2025-11-07 20:02:58 +11:00
Mike Farah
7f72595a12 Cursor generated unit tests 2025-10-12 15:38:40 +11:00
Mike Farah
0ecdce24e8 Bumping version 2025-10-12 14:21:13 +11:00
Mike Farah
6251e95af8 Bumping version 2025-09-08 20:05:05 +10:00
Mike Farah
f03c9dc599 Bumping version 2025-07-23 14:03:02 +10:00
Mike Farah
8e731ac13c Added "debug-node-info" flag for inspecting yq AST 2025-07-15 21:35:54 +10:00
Mike Farah
6e8cc00030 Added flag to fix #2110 2025-07-14 16:26:26 +10:00
Mike Farah
9b299649f7 Refactored initCommand 2025-07-11 10:17:21 +10:00
Mike Farah
369fe56e2d Adding test file (CursorAI) 2025-07-11 09:59:59 +10:00
Mike Farah
1187c954ec Bumping version 2025-07-10 13:09:34 +10:00
Mike Farah
b534aa9ee5 Bumping version 2025-05-11 21:31:47 +10:00
Mike Farah
734e2cd254 Bumping version 2025-05-09 15:48:44 +10:00
Mike Farah
c59fa8de59 Bumping version 2025-05-03 16:40:24 +10:00
Mike Farah
20b5129120 Updating golanglint 2025-05-03 16:34:21 +10:00
Mike Farah
8bf425b4d1 Bumping version 2025-01-12 14:17:39 +11:00
Rudolf Thomas
f73c862cc5 feat: Create parent directories if --split-exp is used.
Problem: When --split-exp is used and produces filenames with slashes in
them, the target directories must already exist otherwise yq fails.

Fix/feature: Create the necessary directories with os.MkdirAll().
The permissions 0750 were chosen to satisfy the vulnerability checker.
2024-12-14 19:52:09 +11:00
Mike Farah
294a1709ad Bumping version 2024-12-07 17:33:47 +11:00
Mike Farah
e204677ff8 Fixed no-colors regression #2218 2024-12-07 16:05:58 +11:00
Mike Farah
bc5b54cb1d Bumping version 2024-11-16 15:45:01 +11:00
Mike Farah
42db154e2e Bumping version 2024-11-16 15:25:31 +11:00
Mike Farah
887b4a560f Fixed linting 2024-11-16 12:04:43 +11:00
Mike Farah
95e7b35f74 Fixed spelling of coloured 2024-11-16 11:54:58 +11:00
Vladimir Varankin
f071a25fa9 cmd: force no color output when NO_COLOR env presents 2024-11-16 11:54:19 +11:00
Mike Farah
b8607bacb9 Prefer not having nolint 2024-11-16 11:52:42 +11:00
Marco Vito Moscaritolo
7eef1a454e exclude lint errors to keep cobra params unchanged 2024-11-16 11:48:53 +11:00
Mike Farah
bbdd97482f Bumping version 2024-08-05 15:38:57 +10:00
Mike Farah
ef6fb92e7f Log printing follow no-colors flag #2082 2024-06-29 15:26:10 +10:00
Mike Farah
f15500b20a Bumping version 2024-06-16 11:13:40 +10:00
Mike Farah
557dcb87b8 Bumping version 2024-05-12 12:27:39 +10:00
Cory Latschkowski
21ba506edb
Fix: shell-completion (#2006)
* fix: shell-completion

* update: description
2024-04-22 14:15:36 +10:00
Mike Farah
19a0e6dd8b Bumping version 2024-03-24 10:54:35 +11:00
Mike Farah
fbd4c8428a Remove old JSON warning 2024-03-23 17:17:23 +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