yq/pkg/yqlib
cobyfrombrooklyn-bot 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
..
doc Fixing TOML subarray parsing issue #2581 2026-01-31 15:25:11 +11:00
all_at_once_evaluator_test.go Refactoring Yaml encoder prefs 2024-02-24 15:36:16 +11:00
all_at_once_evaluator.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
base64_test.go Strip whitespace when decoding base64 #2507 2025-11-15 14:11:55 +11:00
candidate_node_goccy_yaml.go More goccy progress 2025-06-07 15:23:38 +10:00
candidate_node_json.go Fix typo in filename (#2611) 2026-03-21 09:29:07 +11:00
candidate_node_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
candidate_node_yaml.go Updating go-yaml from v3 to v4 2025-09-09 20:05:58 +10:00
candidate_node.go Bumping golint 2026-03-21 09:25:31 +11:00
chown_linux_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
chown_linux.go Log info message when unable to chown file #1521 2023-01-15 11:36:52 +11:00
chown_not_linux_os.go Removed unused debian directory #2000 2024-04-13 11:00:39 +10:00
color_print_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
color_print.go Format comments with a gray foreground 2024-11-10 03:30:03 -06:00
context_test.go Moar tests 2025-07-11 22:00:20 +10:00
context.go Removing copier lib 2023-10-18 12:36:52 +11:00
csv_test.go Fixed CSV content starting with # issue #2076 2024-06-29 15:04:07 +10:00
csv.go Added new CSV option to turn off auto-parsing #1947 2024-02-15 13:11:53 +11:00
data_tree_navigator_test.go Cursor generated unit tests 2025-10-12 15:38:40 +11:00
data_tree_navigator.go Moar tests 2025-07-11 22:00:20 +10:00
decoder_base64.go Strip whitespace when decoding base64 #2507 2025-11-15 14:11:55 +11:00
decoder_csv_object.go Adding tinygo to project words 2025-07-10 13:06:42 +10:00
decoder_goccy_yaml.go goccy yaml decoder supports anchor/aliases 2025-05-03 20:01:16 +10:00
decoder_hcl.go Better roundtriping of HCL 2025-12-08 21:09:21 +11:00
decoder_ini.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
decoder_json.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
decoder_lua.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
decoder_properties.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
decoder_test.go Dont panic on tests 2025-05-04 10:33:09 +10:00
decoder_toml.go Fixing comments in TOML arrays #2592 (#2595) 2026-02-03 19:42:49 +11:00
decoder_uri_test.go More tests 2026-02-01 10:27:18 +11:00
decoder_uri.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
decoder_xml.go fix: keep xml namespace prefixes for tags 2025-10-12 13:42:24 +11:00
decoder_yaml.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
decoder.go Introduced 'format' to encapsulate encoding and decoding formats together 2024-02-24 16:37:13 +11:00
encoder_base64.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
encoder_csv.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
encoder_hcl.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
encoder_ini.go fix tests 2025-05-17 18:55:53 +10:00
encoder_json.go Refactoring JSON encoder prefs 2024-02-24 15:48:59 +11:00
encoder_kyaml.go feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
encoder_lua.go Updating golanglint 2025-05-03 16:34:21 +10:00
encoder_properties_test.go Refactoring Yaml encoder prefs 2024-02-24 15:36:16 +11:00
encoder_properties.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
encoder_sh.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
encoder_shellvariables_test.go Unwrap scalars in shell output mode. (#2548) 2026-01-01 15:21:55 +11:00
encoder_shellvariables.go Unwrap scalars in shell output mode. (#2548) 2026-01-01 15:21:55 +11:00
encoder_test.go Refactoring encoding configuration 2024-02-24 15:59:12 +11:00
encoder_toml.go Fixing comments in TOML arrays #2592 (#2595) 2026-02-03 19:42:49 +11:00
encoder_uri.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
encoder_xml.go Refactoring XML encoder prefs 2024-02-24 15:03:30 +11:00
encoder_yaml.go feat: Add --yaml-compact-seq-indent / -c flag for compact sequence indentation (#2583) 2026-01-31 14:50:01 +11:00
encoder.go feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
expression_parser_test.go Adding more tests 2025-10-12 14:50:41 +11:00
expression_parser.go Adding first operator 2025-11-09 16:12:17 +11:00
expression_postfix.go Updating golanglint 2025-05-03 16:34:21 +10:00
expression_processing_test.go Using new lexer by alecthomas! (#1270) 2022-07-13 14:45:28 +10:00
file_utils.go Add symlink check to file rename util (#2576) 2026-01-22 13:43:32 +11:00
format_test.go convert file ext to lowercase for format detection (#2121) 2024-08-05 15:14:43 +10:00
format.go feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
formatting_expressions_test.go Refactoring encoding configuration 2024-02-24 15:59:12 +11:00
front_matter_test.go fix: preserve original filename when using --front-matter (#2613) 2026-03-26 09:06:20 +11:00
front_matter.go Fixed #1062 2022-01-14 15:22:55 +11:00
goccy_yaml_test.go More goccy progress 2025-06-07 15:23:38 +10:00
hcl_test.go More tests 2026-02-01 10:27:18 +11:00
hcl.go colorise output 2025-12-08 20:30:47 +11:00
ini_test.go fix tests 2025-05-17 18:55:53 +10:00
ini.go fix tests 2025-05-17 18:55:53 +10:00
json_test.go Refactoring encoding configuration 2024-02-24 15:59:12 +11:00
json.go Refactoring encoding configuration 2024-02-24 15:59:12 +11:00
kyaml_test.go feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
kyaml.go feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
lexer_participle_test.go Fixing parsing of escaped characters #2506 2025-11-16 09:12:13 +11:00
lexer_participle.go Fixed merge globbing wildcards in keys #2564 2026-01-31 15:44:50 +11:00
lexer.go Support negative parent indices 2025-12-20 15:36:49 +11:00
lib_test.go Fixing escape charaters again 😢 #2517 2025-11-25 10:17:43 +11:00
lib.go Bumping golint 2026-03-21 09:25:31 +11:00
lua_test.go Refactoring Yaml encoder prefs 2024-02-24 15:36:16 +11:00
lua.go Implement basic Lua output support (#1745) 2023-08-11 12:56:49 +10:00
matchKeyString_test.go Can now retrieve the alias names of merge anchors #1942 2024-02-09 17:24:59 +11:00
matchKeyString.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
no_base64.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
no_csv.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
no_hcl.go colorise output 2025-12-08 20:30:47 +11:00
no_ini.go Fix compilation errors when building build-small-yq 2025-07-01 13:26:26 +08:00
no_json.go Fix compilation errors when building build-small-yq 2025-07-01 13:26:26 +08:00
no_kyaml.go feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
no_lua.go Can build yq with no lua 2023-10-03 16:22:23 +11:00
no_props.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
no_sh.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
no_shellvariables.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
no_toml.go Adding notoml directive to encoder 2025-12-26 11:08:24 +11:00
no_uri.go Add more build tags to reduce binary size 2025-07-01 15:52:40 +08:00
no_xml.go Fix compilation errors when building build-small-yq 2025-07-01 13:26:26 +08:00
operation.go Adding first operator 2025-11-09 16:12:17 +11:00
operator_add_test.go Refining add op 2025-06-12 15:41:27 +10:00
operator_add.go Refining add op 2025-06-12 15:41:27 +10:00
operator_alternative_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_alternative.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_anchors_aliases_test.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
operator_anchors_aliases.go Fixed tests 2025-07-22 11:25:02 +10:00
operator_array_to_map_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_assign_test.go Fixes issue when update against self #1869 2023-11-18 12:19:27 +11:00
operator_assign.go remove unused variable parameters from functions 2024-11-16 11:48:53 +11:00
operator_booleans_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_booleans.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_collect_object_test.go Fixed panic for syntax error when creating a map #2423 2025-07-16 15:35:12 +10:00
operator_collect_object.go Fixed panic for syntax error when creating a map #2423 2025-07-16 15:35:12 +10:00
operator_collect_test.go Adding splat[] short hand to collect,eval,map,omit,path,pick 2024-06-16 10:22:42 +10:00
operator_collect.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_column_test.go Added line and column operators 2022-02-27 11:56:46 +11:00
operator_column.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_comments_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_comments.go Refactoring Yaml encoder prefs 2024-02-24 15:36:16 +11:00
operator_compare.go remove unused variable parameters from functions 2024-11-16 11:48:53 +11:00
operator_contains_test.go Added subset example 2022-11-01 09:29:05 +11:00
operator_contains.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_create_map_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_create_map.go remove unused variable parameters from functions 2024-11-16 11:48:53 +11:00
operator_datetime_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_datetime.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_delete_test.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_delete.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_divide_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_divide.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_document_index_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_document_index.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_encoder_decoder_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_encoder_decoder.go Added tostring #72 2024-03-05 10:40:55 +11:00
operator_entries_test.go Added recursive update map keys example 2025-03-03 15:10:42 +11:00
operator_entries.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_env_test.go Removing escape char processing from strenv #2517 2025-11-25 10:44:03 +11:00
operator_env.go Removing escape char processing from strenv #2517 2025-11-25 10:44:03 +11:00
operator_equals_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_equals.go remove unused variable parameters from functions 2024-11-16 11:48:53 +11:00
operator_error_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_error.go replace error creation 2024-11-16 11:48:53 +11:00
operator_eval_test.go Adding splat[] short hand to collect,eval,map,omit,path,pick 2024-06-16 10:22:42 +10:00
operator_eval.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_expression.go Array to map operator for #1415 2022-11-08 13:40:00 +11:00
operator_file_test.go Added snake_case version of camelCase operators (snake case now prefered) 2022-02-11 09:05:17 +11:00
operator_file.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_filter_test.go Added support for shorthand splat[] for filter,reverse,sort,shuffle 2024-06-15 22:13:58 +10:00
operator_filter.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_first_test.go Improving first op docs 2025-11-09 16:12:17 +11:00
operator_first.go Adding first operator 2025-11-09 16:12:17 +11:00
operator_flatten_test.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_flatten.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_group_by_test.go Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more 2024-06-16 10:48:01 +10:00
operator_group_by.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_has_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_has.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_keys_test.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_keys.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_kind_test.go Added kind operator 2023-10-02 14:43:12 +11:00
operator_kind.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_length_test.go Length (and some other operators) should not include head/foot comments #1231 2022-05-31 16:28:53 +10:00
operator_length.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_line_test.go Minor typos (#1595) 2023-03-16 13:39:36 +11:00
operator_line.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_load_test.go Added flags to disable env and file ops #2515 2025-11-22 09:40:03 +11:00
operator_load.go Added flags to disable env and file ops #2515 2025-11-22 09:40:03 +11:00
operator_map_test.go Fixing running map against empty array bug #2359 2025-05-10 07:24:48 +10:00
operator_map.go Fixing running map against empty array bug #2359 2025-05-10 07:24:48 +10:00
operator_modulo_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_modulo.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_multiply_test.go Multiply uses a readonly context #2558 2026-01-31 16:47:58 +11:00
operator_multiply.go Multiply uses a readonly context #2558 2026-01-31 16:47:58 +11:00
operator_omit_test.go Adding splat[] short hand to collect,eval,map,omit,path,pick 2024-06-16 10:22:42 +10:00
operator_omit.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_parent_test.go Adding negative parent example 2025-12-26 10:53:42 +11:00
operator_parent.go Support negative parent indices 2025-12-20 15:36:49 +11:00
operator_path_test.go Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more 2024-06-16 10:48:01 +10:00
operator_path.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_pick_test.go Added pick including all keys example 2024-09-06 12:32:36 +10:00
operator_pick.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_pipe_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_pipe.go Fixed passing of readonly context in pipe 2023-04-11 12:04:04 +10:00
operator_pivot_test.go Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more 2024-06-16 10:48:01 +10:00
operator_pivot.go pivot operator (#1993) 2024-03-30 13:29:35 +11:00
operator_recursive_descent_test.go Added XML decoder (#1044) 2021-12-21 15:02:07 +11:00
operator_recursive_descent.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_reduce_test.go Added XML decoder (#1044) 2021-12-21 15:02:07 +11:00
operator_reduce.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_reverse_test.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_reverse.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_select_test.go Adding more tests to prevent regression again :sweat 2025-05-09 15:40:29 +10:00
operator_select.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_self.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_shuffle_test.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_shuffle.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_slice_test.go Fixed bug in splice operator #1511 2023-01-13 13:45:19 +11:00
operator_slice.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_sort_keys_test.go Added support for shorthand splat[] for filter,reverse,sort,shuffle 2024-06-15 22:13:58 +10:00
operator_sort_keys.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_sort_test.go fix: correct key order after add, flatten, keys, sort, reverse and shuffle 2025-06-07 21:04:26 +10:00
operator_sort.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_split_document_test.go Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more 2024-06-16 10:48:01 +10:00
operator_split_document.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operator_strings_test.go Skip and warn when interpolating strings and theres a unclosed bracket #2083 2024-06-29 15:20:07 +10:00
operator_strings.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_style_test.go More goccy progress 2025-06-07 15:23:38 +10:00
operator_style.go Updating golanglint 2025-05-03 16:34:21 +10:00
operator_subtract_test.go Fixed array subtraction update bug #2159 2024-09-29 15:21:11 +10:00
operator_subtract.go Fixed array subtraction update bug #2159 2024-09-29 15:21:11 +10:00
operator_tag_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_tag.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_to_number_test.go Added tonumber support #71 2023-10-05 15:15:01 +11:00
operator_to_number.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_traverse_path_test.go Fixed test doc gen 2025-07-23 13:31:25 +10:00
operator_traverse_path.go Fixed merge globbing wildcards in keys #2564 2026-01-31 15:44:50 +11:00
operator_union_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_union.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_unique_test.go More goccy progress 2025-06-07 15:23:38 +10:00
operator_unique.go clean code 2024-06-15 17:06:17 +10:00
operator_value_test.go Fixed value operator bug #1515 2023-01-12 15:11:45 +11:00
operator_value.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_variables_test.go Generic ast (#1829) 2023-10-18 12:11:53 +11:00
operator_variables.go Updated to latest golint 2024-01-11 13:17:34 +11:00
operator_with_test.go Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more 2024-06-16 10:48:01 +10:00
operator_with.go Cleaning up log message formats 2024-02-16 09:44:22 +11:00
operators_compare_test.go min/max operators (#1992) 2024-03-30 13:34:36 +11:00
operators_test.go Fixing error reporting 2025-09-09 20:16:49 +10:00
operators.go Fixing Regression in #2353, #2359, #2325 2025-05-09 15:29:44 +10:00
printer_node_info_test.go More tests 2026-02-01 10:27:18 +11:00
printer_node_info.go Updating go-yaml from v3 to v4 2025-09-09 20:05:58 +10:00
printer_test.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
printer_writer.go feat: Create parent directories if --split-exp is used. 2024-12-14 19:52:09 +11:00
printer.go Switch to uk (#2557) 2025-12-20 19:11:48 +11:00
properties_test.go Updating golanglint 2025-05-03 16:34:21 +10:00
properties.go Refactoring Props encoder prefs 2024-02-24 15:14:21 +11:00
recipes_test.go Added prune recipe 2024-02-21 14:50:55 +11:00
security_prefs.go Added flags to disable env and file ops #2515 2025-11-22 09:40:03 +11:00
shellvariables_test.go Add --shell-key-separator flag for customizable shell output format 2025-11-07 20:02:58 +11:00
shellvariables.go Unwrap scalars in shell output mode. (#2548) 2026-01-01 15:21:55 +11:00
stream_evaluator.go fix: preserve original filename when using --front-matter (#2613) 2026-03-26 09:06:20 +11:00
string_evaluator_test.go Adding a EvaluateAll function to StringEvaluator #1966 2024-03-07 12:02:40 +11:00
string_evaluator.go Adding a EvaluateAll function to StringEvaluator #1966 2024-03-07 12:02:40 +11:00
toml_test.go Fixing comments in TOML arrays #2592 (#2595) 2026-02-03 19:42:49 +11:00
toml.go Colours! 2025-12-14 19:41:45 +11:00
utils.go fix: preserve original filename when using --front-matter (#2613) 2026-03-26 09:06:20 +11:00
write_in_place_handler_test.go Add symlink check to file rename util (#2576) 2026-01-22 13:43:32 +11:00
write_in_place_handler.go Spellig with cspell 2023-09-19 10:43:11 +10:00
xml_test.go Fixed comment parsing, added generated docs 2025-12-08 20:30:47 +11:00
xml.go Refactoring XML encoder prefs 2024-02-24 15:03:30 +11:00
yaml_test.go Fixing handling of CRLF #2352 2025-12-06 19:08:37 +11:00
yaml.go feat: Add --yaml-compact-seq-indent / -c flag for compact sequence indentation (#2583) 2026-01-31 14:50:01 +11:00