yq/cmd
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
..
completion.go Fix: shell-completion (#2006) 2024-04-22 14:15:36 +10:00
constant.go Added "debug-node-info" flag for inspecting yq AST 2025-07-15 21:35:54 +10:00
evaluate_all_command_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
evaluate_all_command.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
evaluate_sequence_command_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
evaluate_sequence_command.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
root_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
root.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
unwrap_flag.go Spellig with cspell 2023-09-19 10:43:11 +10:00
utils_test.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
utils.go Unwrap scalars in shell output mode. (#2548) 2026-01-01 15:21:55 +11:00
version_test.go Clean up cli help doc, add github and doc links 2021-07-09 14:58:09 +10:00
version.go Bumping version 2025-12-20 19:21:32 +11:00