#1876·yq

RFE: ability to specify input filename for stdin

Author: scopCreated Nov 20, 2023Updated Sep 20, 2026
Labelsenhancementhelp wantedv4

Please describe your feature request.

In https://github.com/mikefarah/yq/issues/1484, the input/output mode choice was made defaulting dependent on the input filename. Thanks!

Now, if this would be also possible when processing stdin input, it'd be even nicer. For example, various editor formatter integrations work by piping input to external formatters through stdin. They may have a filename, but the file might not be saved anywhere yet, etc.

Describe the solution you'd like

Other formatters tend to implement this with a cmdline option --stdin <filename> (example: dprint), or --stdin-filename <filename> (example: ruff format). I'd personally go with the latter, it's clearer.

Note that this is just an indication of the filename for format detection purposes. The file does not necessarily exist.

Describe alternatives you've considered

N/A.

Additional context

N/A.