Skip to content

Incorrect value for filename when using --front-matter #2538

Description

@hernancerm

Describe the bug

The value of filename in a query, for a command which has --front-matter, is substituted for the name of a temporary file instead of the correct file name. To reproduce this bug execute any command of the form:

yq --front-matter=<extract-or-process> 'filename' <filepath>

Version of yq: 4.49.2
Operating system: macOS 15.6.1
Installed via: Homebrew

Input Yaml

In this case, not YAML but Markdown:

file.md:

---
name: john
---

Command

The command you ran:

yq --front-matter=extract 'filename' file.md

Actual behavior

/var/folders/zr/8qv9pvw57qzgh6lhjzwhc5k80000gp/T/temp131236935

Expected behavior

file.md

Additional context

Yq documentation:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions