Skip to content

Default to file extension for source format #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mcint opened this issue Mar 28, 2025 · 1 comment · May be fixed by #60
Open

Default to file extension for source format #59

mcint opened this issue Mar 28, 2025 · 1 comment · May be fixed by #60

Comments

@mcint
Copy link

mcint commented Mar 28, 2025

When a file is passed as an argument, we should use the file extension as a input type hint unless an explicit --input parameter is passed.

Current behavior

Yaml parse without argument

$ lq . .rustup/settings.toml
"default_toolchain = \"stable-x86_64-unknown-linux-gnu\" profile = \"default\" version = \"12\"\n[overrides]"

Unwieldy long string, yaml parse of a single string representation of the whole document including newlines.

Expected json output

$ lq --input=toml . .rustup/settings.toml
{
  "default_toolchain": "stable-x86_64-unknown-linux-gnu",
  "overrides": {},
  "profile": "default",
  "version": "12"
}

Desired behavior

For at least these formats of filename, lq should just do the right thing.

  • $ lq . doc.json
  • $ lq . doc.yaml / $ lq . doc.yml
  • $ lq . doc.toml
@clux
Copy link
Owner

clux commented Mar 28, 2025

Ah, that is a nice suggestion. Thank you. Would simplify usage a bit as well. I can have a quick go at this.

@clux clux linked a pull request Mar 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants