TOML "standard selector syntax" Undocumented
Describe the bug This is an obvious documentation bug. There is almost zero documentation on the included TOML support
To Reproduce
TOML file:
[STUFF] mydata = "somestuff" [MORESTUFF] mydata2 = "junk"
"Dasel uses a standard selector syntax no matter the data format. " I want to use your standardized "selectors" to select various values without having to give an explicit path for everything. I don't want to translate to an intermediate format like JSON or YAML.
I don't see anything in your documentation about how to do this with TOML
What is it you're trying to select?
Here's an example of how you can interact with the above data: https://dasel.tomwright.me/s/59c85b2c-0c35-4b5d-ad2b-56c78ff67f6e
dasel -f file.toml '.STUFF.mydata'
If you don't want to use exact paths you can use the search selector.
If I can get a more explicit example of what you're trying to achieve I can probably be a bit more helpful here.
On a side note, I do agree that more docs on exactly how different formats are interpreted would be helpful.
Ok. Here's an example of using the search selector:
[STUFF]
mydata = "somestuff"
[JUNK]
mydata ="other"
without having to know the string "STUFF" or "JUNK", you could do this:
dasel select -m -f data.toml '.(?:-=mydata)'
if you wanted to return the two mydata values. More TOML examples are needed.
I'd like to be able to select just the node headers. For example:
[STUFF]
mydata = "somestuff"
[JUNK]
mydata ="other"
How do I select just "[STUFF]" and "[JUNK]" (not including mydata) without using the strings "STUFF" and "JUNK"?
For that you can use the keys and indexes selector.
dasel -f file.toml -m '.-'
STUFF
MORESTUFF
Or if you wanted to select just the data without knowing the keys:
dasel -f file.toml -m '.[*]'
mydata = "somestuff"
mydata2 = "junk"
Or this:
dasel -f file.toml -m '.[*].[*]'
somestuff
junk
These are great examples. Please add them to the main documentation. It would probably be useful to have sections for each format you support e.g. a JSON section, a TOML section, a YAML section, a section for going from one format to another, etc.......
Note that dasel --help produces the following Usage section:
Usage:
dasel select -f <file> -p <json,yaml> -s <selector> [flags]
... essentially implying there's only json and yaml parsers.
Note that
dasel --helpproduces the following Usage section:Usage: dasel select -f <file> -p <json,yaml> -s <selector> [flags]... essentially implying there's only json and yaml parsers.
I've just fixed this