Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Quotes in output if string is number #90

Closed
paradajz opened this issue Feb 11, 2021 · 1 comment
Closed

Quotes in output if string is number #90

paradajz opened this issue Feb 11, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@paradajz
Copy link

Given the following YAML example:

  analog:
    type: "native"

Running dasel -n -f demo.yml analog.type gives me native. No quotes. However, if type is something like this:

  analog:
    type: "4067"

Running the same command gives me "4067". Notice the quotes in output. Is this a bug or am I missing something here?

@paradajz paradajz added the bug Something isn't working label Feb 11, 2021
@TomWright
Copy link
Owner

Hey @paradajz - This isn't a bug.

Since you are referencing a YAML file the input + output is being parsed/formatted as YAML.

  • "native" is a string
  • native is a string
  • "4067" is a string
  • 4067 is an int

In order for dasel to output 4067 as a string it must be surrounded by quotes.

If you do not want the output to be formatted as yaml you can use the -w - flag or --plain flag.

These are equivalent for this use-case and will cause the output to be native and 4067 without quotes.

$ dasel -n -f demo.yml --plain analog.type
4067

Repository owner locked and limited conversation to collaborators Feb 11, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants