yq icon indicating copy to clipboard operation
yq copied to clipboard

filename returns temporary file with front matter processing

Open Zash opened this issue 1 year ago • 1 comments

Describe the bug When operating on front matter, the filename operator unexpectedly returns what appears to be the name of a temporary file e.g. /tmp/temp1090143499 instead of the name of the file being operated on, e.g. document.md

Version of yq: 4.44.2 Operating system: Debian 12 Linux Installed via: binary download from Github

Input Yaml Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less) hello.md:

---
title: Hello
---

# Hello

Lorem ipsum

Command The command you ran:

yq --front-matter extract 'filename' hello.md

Actual behavior

/tmp/temp918014150

Expected behavior

hello.md

Zash avatar Jul 21 '24 14:07 Zash

I could see a world in which there is another operator (original_filename?) that holds the non-temporary filename. But I don't really see much point in including the temporary filename at all. So it would be ideal if the filename operator just returned what you are actually looking for.

jericson avatar Dec 03 '25 22:12 jericson