Skip to content
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

Inconsistent behaviour while loading multiple files vs single file #1901

Closed
olorin37 opened this issue Apr 30, 2024 · 2 comments
Closed

Inconsistent behaviour while loading multiple files vs single file #1901

olorin37 opened this issue Apr 30, 2024 · 2 comments

Comments

@olorin37
Copy link
Contributor

olorin37 commented Apr 30, 2024

Problem

I found inconsistency, while loading two or more files any importable (json, yaml, toml) can be used otherwise only nickel file is allowed (examples works both for eval or export sub-commands):

nickel export my.yaml my.ncl    # => works

It works, does merge of two imported objects underneath as (import "my.yaml") & (import "my.ncl"). It is also works even there is no nickel file for example:

nickel export my.yaml my.toml my.json    # => works

But if we use only one file, it doesn't as it expects nickel syntax:

nickel export my.yaml    # => fails
nickel export my.toml    # => fails
nickel export my.json    # => fails

Solution?

  1. One, a little stupid idea is to import file even if this is only one file. Then we got consistent behaviour and also all files will be accepted. Actually I prefer this (it allows "abuse" of nickel as format converter: nickel export -f toml my.yaml -o my.toml.
  2. Disallow other than native, nickel files to be provided as an input, by a validation.

What you think?

@yannham
Copy link
Member

yannham commented Apr 30, 2024

Hello,

There is absolutely no good reason behind Nickel not accepting a yaml, json or toml file as a single input indeed, nor there is any technical limitation. It's sensible and is easy to implement, so we'll definitely do that 🙂

@yannham yannham added this to the Next Minor (1.7) milestone Apr 30, 2024
olorin37 added a commit to olorin37/nickel that referenced this issue May 3, 2024
Guess input format based on extension similarly like in multiple input case.
olorin37 added a commit to olorin37/nickel that referenced this issue May 4, 2024
Guess input format based on extension similarly like in multiple input case.
olorin37 added a commit to olorin37/nickel that referenced this issue May 4, 2024
Guess input format based on extension similarly like in multiple input case.
olorin37 added a commit to olorin37/nickel that referenced this issue May 5, 2024
Guess input format based on extension similarly like in multiple input case.
olorin37 added a commit to olorin37/nickel that referenced this issue May 6, 2024
Guess input format based on extension similarly like in multiple input case.
olorin37 added a commit to olorin37/nickel that referenced this issue May 6, 2024
Guess input format based on extension similarly like in multiple input case.
github-merge-queue bot pushed a commit that referenced this issue May 7, 2024
Guess input format based on extension similarly like in multiple input case.
@yannham
Copy link
Member

yannham commented May 7, 2024

Fixed in #1902.

@yannham yannham closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants