Skip to content

if the key in the command line is a filename is processed as file #2477

@kuisathaverat

Description

@kuisathaverat

Describe the bug

When you search for a key something that you pass as .something in the command line, and there is a filename in that folder with the name .something that file is procesed and the key ignored

Version of yq: 4.47.1
Operating system: mac
Installed via: homebrew

Input Yaml

YAML file we want to parse

data.yml:

foo: bar
bar: foo
version: 1.1.1

An additional file exists in the same directory

.version

boooom

Command
The command you ran:

yq '.version' data.yml 

Actual behavior

boooom
---
foo: bar
bar: foo
version: 1.1.1

Expected behavior

1.1.1

Workaround

yq  --expression '.version' data.yml 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions