397 Commits
Author SHA1 Message Date
Mike Farah c14f446382 Bumping version 2026-08-20 19:07:38 +10:00
Mike Farah e95064cd01 Bumping version 2026-08-20 16:16:13 +10:00
Mike Farah ce7026e319 Bumping version 2026-08-19 14:32:17 +10:00
Joeseph GreyandGitHub 86ce5860d5 fix: reject negative indent instead of panicking (#2746) 2026-08-03 11:37:58 +10:00
Mike Farah 1b9b4ac518 Bumping version 2026-06-06 20:59:47 +10:00
6f9201a0ca feat: add --ini-preserve-quotes flag for INI round-trip quote preservation (#2728)
Add INIPreferences.PreserveSurroundedQuote option that wires through to
go-ini/ini's LoadOptions.PreserveSurroundedQuote. When enabled, existing
surrounding quotes on INI values are preserved during decode/encode
round-trips.

Fixes #2456

Co-authored-by: toller892 <toller892@gmail.com>
2026-06-06 16:20:29 +10:00
Mike Farah 751d8ad57b Bumping version 2026-04-17 16:03:30 +10:00
Mike Farah e969dd789f Bumping version 2026-04-17 15:36:22 +10:00
CopilotGitHubmikefarahCopilotcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>Mike Farah
44c55c8a54 Add system(command; args) operator (disabled by default) (#2640)
* Initial plan

* Add system(command; args) operator with --enable-system-operator flag

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/8a11e9a0-10d2-4f2a-ae29-4e9d0bfc266f

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

* Update pkg/yqlib/operator_system.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Evaluate system command/args per matched node using SingleReadonlyChildContext

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/dca841eb-3f63-4f23-adeb-556431560420

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

* Add yqFlags to expressionScenario for doc command snippets; fix system op docs

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/3f8a5375-25fd-4428-a8e6-b630194c36b2

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

* Update pkg/yqlib/doc/operators/headers/system-operators.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update pkg/yqlib/doc/operators/system-operators.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Validate command node type and handle multiple results with debug log

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/928aabc5-ad71-41d8-94ab-403942e3f92d

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove deprecated --enable-system-operator alias; use --security-enable-system-operator consistently

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/286b95e9-b6d7-4ab8-b401-2d7a03853922

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address deep review feedback: error on disabled, strict arg/cmd validation, debug logs, docs

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/fbfba2db-60ea-4c20-a4c2-0fd396b80c81

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
Co-authored-by: Mike Farah <mikefarah@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-10 20:06:46 +10:00
CopilotGitHubmikefarahcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
7d8d3ab902 Replace gopkg.in/op/go-logging.v1 with log/slog (#2635)
* Initial plan

* Replace gopkg.in/op/go-logging.v1 with log/slog

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/aa9c12f4-21b9-4633-9868-6b56585b247f

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
2026-03-26 20:41:54 +11:00
Mike Farah 0f4fb8d35e Bumping version 2026-03-26 10:03:01 +11:00
Mike Farah 80c319aa0c Fixing tests with latest linting rules 2026-03-26 09:29:51 +11:00
b151522485 fix: preserve original filename when using --front-matter (#2613)
When using --front-matter, yq creates a temporary file for the
extracted YAML content but replaces the original filename in args
with the temp file path. This caused the 'filename' operator to
return the temp file path instead of the original filename.

Added a filename alias mechanism: when front matter processing
replaces the file path, it registers the original filename as an
alias. The readDocuments and stream evaluator functions resolve
aliases before setting candidateNode.filename.

Fixes #2538

Co-authored-by: cobyfrombrooklyn-bot <cobyfrombrooklyn@gmail.com>
2026-03-26 09:06:20 +11:00
Mike Farah 6a965bc39a Bumping golint 2026-03-21 09:25:31 +11:00
Mike Farah 5a7e72a743 Bumping version 2026-02-14 18:43:09 +11:00
Mike Farah 2c471b6498 Bumping version 2026-02-14 11:51:00 +11:00
Mike Farah eb04fa87af More tests 2026-02-01 10:27:18 +11:00
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
jfenalandGitHub 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 WintersandGitHub 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
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 FarahandGitHub 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 LeeandMike Farah 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 ThomasandMike Farah 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