Skip to content

Default to file extension for source format #59

@mcint

Description

@mcint

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions