yerba 0.9.1-aarch64-linux-gnu → 0.10.0-aarch64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +60 -16
- data/exe/aarch64-linux-gnu/yerba +0 -0
- data/ext/yerba/include/yerba.h +67 -32
- data/ext/yerba/yerba.c +296 -186
- data/lib/yerba/3.2/yerba.so +0 -0
- data/lib/yerba/3.3/yerba.so +0 -0
- data/lib/yerba/3.4/yerba.so +0 -0
- data/lib/yerba/4.0/yerba.so +0 -0
- data/lib/yerba/collection.rb +4 -4
- data/lib/yerba/document.rb +134 -0
- data/lib/yerba/formatting.rb +1 -0
- data/lib/yerba/location.rb +8 -1
- data/lib/yerba/map.rb +16 -6
- data/lib/yerba/node.rb +41 -0
- data/lib/yerba/query_result.rb +33 -10
- data/lib/yerba/scalar.rb +29 -0
- data/lib/yerba/selector.rb +142 -0
- data/lib/yerba/sequence.rb +38 -33
- data/lib/yerba/version.rb +1 -1
- data/lib/yerba.rb +1 -0
- data/rust/Cargo.lock +1 -1
- data/rust/Cargo.toml +1 -1
- data/rust/src/commands/get.rs +12 -12
- data/rust/src/commands/init.rs +8 -8
- data/rust/src/commands/insert.rs +4 -18
- data/rust/src/commands/location.rs +2 -0
- data/rust/src/commands/mod.rs +34 -6
- data/rust/src/commands/move_item.rs +1 -1
- data/rust/src/commands/move_key.rs +8 -8
- data/rust/src/commands/rename.rs +1 -1
- data/rust/src/commands/selectors.rs +1 -1
- data/rust/src/commands/set.rs +14 -6
- data/rust/src/document/condition.rs +25 -25
- data/rust/src/document/delete.rs +57 -43
- data/rust/src/document/get.rs +91 -82
- data/rust/src/document/insert.rs +77 -77
- data/rust/src/document/mod.rs +138 -64
- data/rust/src/document/nodes.rs +162 -0
- data/rust/src/document/schema.rs +8 -8
- data/rust/src/document/set.rs +49 -26
- data/rust/src/document/sort.rs +54 -54
- data/rust/src/document/style.rs +50 -49
- data/rust/src/document/unique.rs +5 -5
- data/rust/src/error.rs +8 -4
- data/rust/src/ffi.rs +272 -102
- data/rust/src/json.rs +62 -2
- data/rust/src/lib.rs +2 -1
- data/rust/src/main.rs +2 -1
- data/rust/src/selector.rs +48 -7
- data/rust/src/syntax.rs +449 -56
- data/rust/src/validation.rs +5 -3
- data/rust/src/yerbafile.rs +124 -76
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 118917ba4d0025450859477d389d2c1f086abd38e03afc43660ce4872f9b84a9
|
|
4
|
+
data.tar.gz: af5d4cdb8c867bf27841cec7423ac1ae3865b406d64d8b8759cc13508e41f965
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f425c1681c868c48ecf6947dce6fd7dfcd5e43cbf071dddded0ed54a4f73210b527f22eea2b323574272a8db913ff63f93ea6eb5436c0b6cc7e7c1d9ac76692b
|
|
7
|
+
data.tar.gz: 13cef239ee5ede0fcc6898d9e8209eaa4b88aabb91fa80638612fbb8d9dde761f6bbf0540706a8e87e90f86126d6dcde47a03ed24e6cdb97c4a67bdaf9879ae8
|
data/README.md
CHANGED
|
@@ -47,7 +47,7 @@ Use `yerba` as a library in your Rust project:
|
|
|
47
47
|
|
|
48
48
|
```toml
|
|
49
49
|
[dependencies]
|
|
50
|
-
yerba = "0.
|
|
50
|
+
yerba = "0.10"
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
```rust
|
|
@@ -93,9 +93,10 @@ Selectors let you address any node in a YAML document:
|
|
|
93
93
|
| Pattern | Meaning | Example |
|
|
94
94
|
|-------------------|---------------------|----------------------------|
|
|
95
95
|
| `key` | A single key | `"database.host"` |
|
|
96
|
-
| `key.nested` | Nested
|
|
96
|
+
| `key.nested` | Nested keys | `"database.settings.pool"` |
|
|
97
97
|
| `[]` | All items in array | `"[].title"` |
|
|
98
98
|
| `[N]` | Item at index | `"[0].title"` |
|
|
99
|
+
| `[-N]` | Item from the end | `"[-1].title"` |
|
|
99
100
|
| `*` | All values in a map | `"database.*"` |
|
|
100
101
|
| `[].key[].nested` | Nested array access | `"[].speakers[].name"` |
|
|
101
102
|
|
|
@@ -149,14 +150,14 @@ yerba get videos.yml "[]" --condition ".speakers contains Matz" --raw
|
|
|
149
150
|
|
|
150
151
|
### `set`
|
|
151
152
|
|
|
152
|
-
Update an existing value at a
|
|
153
|
+
Update an existing value at a selector. The original quote style is preserved automatically, if a value was double-quoted before, it stays double-quoted after the edit.
|
|
153
154
|
|
|
154
155
|
```bash
|
|
155
156
|
yerba set config.yml "database.host" "0.0.0.0"
|
|
156
157
|
yerba set videos.yml "[0].title" "New Title"
|
|
157
158
|
```
|
|
158
159
|
|
|
159
|
-
Use `--if-exists` to only set the value when the
|
|
160
|
+
Use `--if-exists` to only set the value when the selector already exists, or `--if-missing` to only set it when the selector does not exist:
|
|
160
161
|
|
|
161
162
|
```bash
|
|
162
163
|
yerba set config.yml "database.host" "0.0.0.0" --if-exists
|
|
@@ -189,7 +190,7 @@ Use `--all` to update all nodes matching a wildcard selector:
|
|
|
189
190
|
yerba set videos.yml "[].description" "" --all
|
|
190
191
|
```
|
|
191
192
|
|
|
192
|
-
Values are written in the quote style already at the
|
|
193
|
+
Values are written in the quote style already at the selector, which keeps string edits tidy. A value is quoted anyway when writing it plain would not read back as the string you passed, so `yes` becomes `"yes"` and `12345` becomes `"12345"` — whatever the field held before. Use `--plain` to write a YAML literal instead:
|
|
193
194
|
|
|
194
195
|
```bash
|
|
195
196
|
yerba set config.yml "database.replica" null --plain
|
|
@@ -469,10 +470,14 @@ Output:
|
|
|
469
470
|
"end_line": 2,
|
|
470
471
|
"end_column": 19,
|
|
471
472
|
"start_offset": 22,
|
|
472
|
-
"end_offset": 32
|
|
473
|
+
"end_offset": 32,
|
|
474
|
+
"start_character_column": 9,
|
|
475
|
+
"end_character_column": 19
|
|
473
476
|
}
|
|
474
477
|
```
|
|
475
478
|
|
|
479
|
+
Lines are 1-based and columns are 0-based, like Prism. `start_column` and `end_column` count bytes, `start_character_column` and `end_character_column` count characters, and offsets are byte offsets into the file.
|
|
480
|
+
|
|
476
481
|
### `schema`
|
|
477
482
|
|
|
478
483
|
Validate YAML files against a JSON schema:
|
|
@@ -482,7 +487,7 @@ yerba schema data/speakers.yml --schema lib/schemas/speaker_schema.json
|
|
|
482
487
|
yerba schema "data/**/videos.yml" --schema lib/schemas/video_schema.json
|
|
483
488
|
```
|
|
484
489
|
|
|
485
|
-
Use `--
|
|
490
|
+
Use `--selector` to scope validation to a specific selector (e.g. validate each item in an array):
|
|
486
491
|
|
|
487
492
|
```bash
|
|
488
493
|
yerba schema data/speakers.yml --schema speaker_schema.json --selector "[]"
|
|
@@ -579,11 +584,11 @@ rules:
|
|
|
579
584
|
- files: "data/**/videos.yml"
|
|
580
585
|
pipeline:
|
|
581
586
|
- quote_style:
|
|
582
|
-
|
|
587
|
+
selector: "[].speakers"
|
|
583
588
|
value_style: plain
|
|
584
589
|
|
|
585
590
|
- sort_keys:
|
|
586
|
-
|
|
591
|
+
selector: "[]"
|
|
587
592
|
order:
|
|
588
593
|
- id
|
|
589
594
|
- title
|
|
@@ -592,7 +597,7 @@ rules:
|
|
|
592
597
|
- files: "data/speakers.yml"
|
|
593
598
|
pipeline:
|
|
594
599
|
- sort_keys:
|
|
595
|
-
|
|
600
|
+
selector: "[]"
|
|
596
601
|
order:
|
|
597
602
|
- name
|
|
598
603
|
- slug
|
|
@@ -602,13 +607,15 @@ rules:
|
|
|
602
607
|
by: name
|
|
603
608
|
```
|
|
604
609
|
|
|
610
|
+
Rules and steps take a `selector` to scope them. `path` is still accepted as the older name for it.
|
|
611
|
+
|
|
605
612
|
Available pipeline steps:
|
|
606
613
|
|
|
607
|
-
- `quote_style` Enforce quote style on keys and/or values, optionally scoped by
|
|
614
|
+
- `quote_style` Enforce quote style on keys and/or values, optionally scoped by selector
|
|
608
615
|
- `collection_style` Enforce flow or block style on collections
|
|
609
616
|
- `sequence_indent` Enforce compact or indented sequence style
|
|
610
617
|
- `sort_keys` Reorder keys to match a predefined list
|
|
611
|
-
- `sort` Sort sequence items by field(s)
|
|
618
|
+
- `sort` Sort sequence items by field(s), `by: ".date,.start_time"` or `by: ".date .start_time"` for tie-breakers
|
|
612
619
|
- `blank_lines` Enforce blank lines between sequence entries, optionally limited to named map keys with `before` and to non-empty values with `skip_empty`
|
|
613
620
|
- `set` Set a value (supports conditions, and `plain: true` for YAML literals)
|
|
614
621
|
- `insert` Insert a new key or sequence item (`plain: true` for YAML literals and fragments)
|
|
@@ -617,8 +624,8 @@ Available pipeline steps:
|
|
|
617
624
|
- `remove` Remove an item from a sequence
|
|
618
625
|
- `directives` Add or remove the document start marker (`---`), with optional `max` validation
|
|
619
626
|
- `unique` Find or remove duplicate items in a sequence
|
|
620
|
-
- `schema` Validate against a JSON schema (with optional `
|
|
621
|
-
- `escapes` Spell escaped characters literally where the quote style can carry them (with optional `
|
|
627
|
+
- `schema` Validate against a JSON schema (with optional `selector` for scoping)
|
|
628
|
+
- `escapes` Spell escaped characters literally where the quote style can carry them (with optional `selector` for scoping)
|
|
622
629
|
- `final_newline` Enforce exact number of trailing newlines (`count: 1` by default, strips extras)
|
|
623
630
|
|
|
624
631
|
This makes it easy to enforce project-wide YAML conventions in CI:
|
|
@@ -747,7 +754,7 @@ document["database"]["host"].value # => "localhost"
|
|
|
747
754
|
document["database.host"].value # => "localhost" (same thing)
|
|
748
755
|
```
|
|
749
756
|
|
|
750
|
-
The returned object type depends on what's at the
|
|
757
|
+
The returned object type depends on what's at the selector:
|
|
751
758
|
|
|
752
759
|
```ruby
|
|
753
760
|
document["database"] # => Yerba::Map
|
|
@@ -900,9 +907,14 @@ document.sort(by: :name, order: ["Charlie", "Bob", "Alice"])
|
|
|
900
907
|
document.sort("tags")
|
|
901
908
|
document.sort("tags", order: :desc)
|
|
902
909
|
document.sort("tags", order: ["rust", "ruby", "go"])
|
|
910
|
+
document.sort("tags", order: "rust,ruby,go")
|
|
911
|
+
document.sort(by: [:date, :start_time])
|
|
912
|
+
document.sort(by: ".date .start_time")
|
|
903
913
|
```
|
|
904
914
|
|
|
905
|
-
The `by:` option accepts symbols, strings, or dot-prefixed strings (`:name`, `"name"`, `".name"`).
|
|
915
|
+
The `by:` option accepts symbols, strings, or dot-prefixed strings (`:name`, `"name"`, `".name"`). Several fields, separated by commas or spaces or given as an Array, sort by the first and break ties with the next.
|
|
916
|
+
|
|
917
|
+
The `order:` option is `:asc`, `:desc`, or an explicit order of values as an Array or comma-separated String.
|
|
906
918
|
|
|
907
919
|
### Querying
|
|
908
920
|
|
|
@@ -1038,8 +1050,12 @@ loc.end_line # => 2
|
|
|
1038
1050
|
loc.end_column # => 19
|
|
1039
1051
|
loc.start_offset # => 22
|
|
1040
1052
|
loc.end_offset # => 32
|
|
1053
|
+
loc.start_character_column # => 9
|
|
1054
|
+
loc.end_character_column # => 19
|
|
1041
1055
|
```
|
|
1042
1056
|
|
|
1057
|
+
Lines are 1-based and columns are 0-based, matching `Prism::Location`. `start_column` and `end_column` count bytes, `start_character_column` and `end_character_column` count characters, so they differ on lines with non-ASCII text before the value.
|
|
1058
|
+
|
|
1043
1059
|
You can also get a location by selector string:
|
|
1044
1060
|
|
|
1045
1061
|
```ruby
|
|
@@ -1165,6 +1181,34 @@ scalars.first.value = "New Title"
|
|
|
1165
1181
|
scalars.first.document.save!
|
|
1166
1182
|
```
|
|
1167
1183
|
|
|
1184
|
+
### Parsing Selectors
|
|
1185
|
+
|
|
1186
|
+
`Yerba::Selector` splits a selector into its segments, using the same parser as the rest of Yerba. Keys are Strings, indexes Integers (negative from the end), `[]` is `:all_items` and `*` is `:all_keys`:
|
|
1187
|
+
|
|
1188
|
+
```ruby
|
|
1189
|
+
selector = Yerba::Selector.parse("[3].talks[1]")
|
|
1190
|
+
|
|
1191
|
+
selector.segments # => [3, "talks", 1]
|
|
1192
|
+
selector.parent # => "[3].talks"
|
|
1193
|
+
selector.join("speakers", 0).to_s # => "[3].talks[1].speakers[0]"
|
|
1194
|
+
|
|
1195
|
+
Yerba::Selector.parse("[].speakers[]").segments # => [:all_items, "speakers", :all_items]
|
|
1196
|
+
Yerba::Selector.parse(".title").relative? # => true
|
|
1197
|
+
Yerba::Selector.parse("tags[-1]").segments # => ["tags", -1]
|
|
1198
|
+
|
|
1199
|
+
Yerba::Selector.build([3, "talks", 1]).to_s # => "[3].talks[1]"
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
`dig` looks a concrete selector up in plain Ruby values, such as the cached `Document#values`, without calling into the native extension. Use it when reading many values from the same document:
|
|
1203
|
+
|
|
1204
|
+
```ruby
|
|
1205
|
+
values = document.values
|
|
1206
|
+
|
|
1207
|
+
Yerba::Selector.parse("[3].talks[1].title").dig(values) # => same as document.value_at("[3].talks[1].title")
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
Parsed selectors are cached per string, so parsing the same selector again is free.
|
|
1211
|
+
|
|
1168
1212
|
### Saving
|
|
1169
1213
|
|
|
1170
1214
|
Write changes back to the original file:
|
data/exe/aarch64-linux-gnu/yerba
CHANGED
|
Binary file
|
data/ext/yerba/include/yerba.h
CHANGED
|
@@ -46,6 +46,8 @@ typedef struct YerbaLocation {
|
|
|
46
46
|
uintptr_t start_column;
|
|
47
47
|
uintptr_t end_line;
|
|
48
48
|
uintptr_t end_column;
|
|
49
|
+
uintptr_t start_character_column;
|
|
50
|
+
uintptr_t end_character_column;
|
|
49
51
|
} YerbaLocation;
|
|
50
52
|
|
|
51
53
|
typedef struct YerbaGetResult {
|
|
@@ -64,6 +66,22 @@ typedef struct YerbaResult {
|
|
|
64
66
|
char *error;
|
|
65
67
|
} YerbaResult;
|
|
66
68
|
|
|
69
|
+
typedef struct YerbaNodeRecord {
|
|
70
|
+
intptr_t parent;
|
|
71
|
+
enum NodeType node_type;
|
|
72
|
+
char *selector;
|
|
73
|
+
char *key_name;
|
|
74
|
+
struct YerbaTypedValue value;
|
|
75
|
+
bool has_value;
|
|
76
|
+
struct YerbaLocation location;
|
|
77
|
+
struct YerbaLocation key_location;
|
|
78
|
+
} YerbaNodeRecord;
|
|
79
|
+
|
|
80
|
+
typedef struct YerbaNodeList {
|
|
81
|
+
struct YerbaNodeRecord *records;
|
|
82
|
+
uintptr_t length;
|
|
83
|
+
} YerbaNodeList;
|
|
84
|
+
|
|
67
85
|
struct YerbaParseResult yerba_document_parse_file(const char *path);
|
|
68
86
|
|
|
69
87
|
struct YerbaParseResult yerba_document_parse(const char *content);
|
|
@@ -72,64 +90,77 @@ uint64_t yerba_document_generation(const struct Document *document);
|
|
|
72
90
|
|
|
73
91
|
void yerba_document_free(struct Document *document);
|
|
74
92
|
|
|
75
|
-
struct YerbaGetResult yerba_document_get(const struct Document *document, const char *
|
|
93
|
+
struct YerbaGetResult yerba_document_get(const struct Document *document, const char *selector);
|
|
76
94
|
|
|
77
95
|
/**
|
|
78
96
|
* Caller must free with yerba_string_free.
|
|
79
97
|
*/
|
|
80
|
-
char *yerba_document_source(const struct Document *document, const char *
|
|
98
|
+
char *yerba_document_source(const struct Document *document, const char *selector);
|
|
81
99
|
|
|
82
100
|
/**
|
|
83
101
|
* Caller must free with yerba_string_free.
|
|
84
102
|
*/
|
|
85
|
-
char *yerba_document_get_value(const struct Document *document, const char *
|
|
103
|
+
char *yerba_document_get_value(const struct Document *document, const char *selector);
|
|
86
104
|
|
|
87
105
|
/**
|
|
88
106
|
* Caller must free with yerba_string_free.
|
|
89
107
|
*/
|
|
90
108
|
char *yerba_document_selectors(const struct Document *document);
|
|
91
109
|
|
|
92
|
-
char *yerba_document_resolve_selectors(const struct Document *document, const char *
|
|
110
|
+
char *yerba_document_resolve_selectors(const struct Document *document, const char *selector);
|
|
93
111
|
|
|
94
|
-
bool yerba_selector_has_wildcard(const char *
|
|
112
|
+
bool yerba_selector_has_wildcard(const char *selector);
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Parses a selector into JSON: `{"relative": bool, "segments": [...]}`.
|
|
116
|
+
*
|
|
117
|
+
* Keys are encoded as strings, indexes as integers (negative from the end), `[]` as `{"all": "items"}` and `*` as `{"all": "keys"}`.
|
|
118
|
+
*/
|
|
119
|
+
char *yerba_selector_parse(const char *selector);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Builds a selector string from a JSON array of segments, encoded like `yerba_selector_parse` returns them.
|
|
123
|
+
*/
|
|
124
|
+
char *yerba_selector_build(const char *segments_json,
|
|
125
|
+
bool relative);
|
|
97
126
|
|
|
98
|
-
char *
|
|
127
|
+
char *yerba_document_keys(const struct Document *document, const char *selector);
|
|
128
|
+
|
|
129
|
+
char *yerba_document_get_quote_style(const struct Document *document, const char *selector);
|
|
99
130
|
|
|
100
131
|
struct YerbaResult yerba_document_set_quote_style(struct Document *document,
|
|
101
|
-
const char *
|
|
132
|
+
const char *selector,
|
|
102
133
|
const char *style);
|
|
103
134
|
|
|
104
|
-
char *yerba_document_get_collection_style(const struct Document *document, const char *
|
|
135
|
+
char *yerba_document_get_collection_style(const struct Document *document, const char *selector);
|
|
105
136
|
|
|
106
137
|
struct YerbaResult yerba_document_set_collection_style(struct Document *document,
|
|
107
|
-
const char *
|
|
138
|
+
const char *selector,
|
|
108
139
|
const char *style);
|
|
109
140
|
|
|
110
|
-
char *yerba_document_get_sequence_indent(const struct Document *document, const char *
|
|
141
|
+
char *yerba_document_get_sequence_indent(const struct Document *document, const char *selector);
|
|
111
142
|
|
|
112
143
|
struct YerbaResult yerba_document_set_sequence_indent(struct Document *document,
|
|
113
|
-
const char *
|
|
144
|
+
const char *selector,
|
|
114
145
|
const char *style);
|
|
115
146
|
|
|
116
147
|
char *yerba_validate_condition(const char *condition, bool item_context);
|
|
117
148
|
|
|
118
149
|
bool yerba_document_evaluate_condition(const struct Document *document,
|
|
119
|
-
const char *
|
|
150
|
+
const char *parent_selector,
|
|
120
151
|
const char *condition);
|
|
121
152
|
|
|
122
|
-
bool yerba_document_exists(const struct Document *document, const char *
|
|
153
|
+
bool yerba_document_exists(const struct Document *document, const char *selector);
|
|
123
154
|
|
|
124
|
-
bool yerba_document_valid_selector(const struct Document *document, const char *
|
|
155
|
+
bool yerba_document_valid_selector(const struct Document *document, const char *selector);
|
|
125
156
|
|
|
126
157
|
char *yerba_document_find(const struct Document *document,
|
|
127
|
-
const char *
|
|
158
|
+
const char *selector,
|
|
128
159
|
const char *condition,
|
|
129
160
|
const char *select);
|
|
130
161
|
|
|
131
162
|
struct YerbaResult yerba_document_set(struct Document *document,
|
|
132
|
-
const char *
|
|
163
|
+
const char *selector,
|
|
133
164
|
const char *value,
|
|
134
165
|
uintptr_t value_length,
|
|
135
166
|
enum YerbaValueType value_type,
|
|
@@ -137,7 +168,7 @@ struct YerbaResult yerba_document_set(struct Document *document,
|
|
|
137
168
|
bool all);
|
|
138
169
|
|
|
139
170
|
struct YerbaResult yerba_document_insert(struct Document *document,
|
|
140
|
-
const char *
|
|
171
|
+
const char *selector,
|
|
141
172
|
const char *value,
|
|
142
173
|
uintptr_t value_length,
|
|
143
174
|
enum YerbaValueType value_type,
|
|
@@ -148,28 +179,28 @@ struct YerbaResult yerba_document_insert(struct Document *document,
|
|
|
148
179
|
int64_t at);
|
|
149
180
|
|
|
150
181
|
struct YerbaResult yerba_document_insert_object(struct Document *document,
|
|
151
|
-
const char *
|
|
182
|
+
const char *selector,
|
|
152
183
|
const char *json,
|
|
153
184
|
const char *before,
|
|
154
185
|
const char *after,
|
|
155
186
|
int64_t at);
|
|
156
187
|
|
|
157
|
-
struct YerbaResult yerba_document_delete(struct Document *document, const char *
|
|
188
|
+
struct YerbaResult yerba_document_delete(struct Document *document, const char *selector);
|
|
158
189
|
|
|
159
190
|
struct YerbaResult yerba_document_insert_objects(struct Document *document,
|
|
160
|
-
const char *
|
|
191
|
+
const char *selector,
|
|
161
192
|
const char *json);
|
|
162
193
|
|
|
163
194
|
struct YerbaResult yerba_document_remove(struct Document *document,
|
|
164
|
-
const char *
|
|
195
|
+
const char *selector,
|
|
165
196
|
const char *value);
|
|
166
197
|
|
|
167
198
|
struct YerbaResult yerba_document_remove_at(struct Document *document,
|
|
168
|
-
const char *
|
|
199
|
+
const char *selector,
|
|
169
200
|
uintptr_t index);
|
|
170
201
|
|
|
171
202
|
struct YerbaResult yerba_document_move_item(struct Document *document,
|
|
172
|
-
const char *
|
|
203
|
+
const char *selector,
|
|
173
204
|
uintptr_t from,
|
|
174
205
|
uintptr_t to);
|
|
175
206
|
|
|
@@ -178,26 +209,26 @@ struct YerbaResult yerba_document_rename(struct Document *document,
|
|
|
178
209
|
const char *dest);
|
|
179
210
|
|
|
180
211
|
struct YerbaResult yerba_document_sort(struct Document *document,
|
|
181
|
-
const char *
|
|
212
|
+
const char *selector,
|
|
182
213
|
const char *by,
|
|
183
214
|
bool case_sensitive);
|
|
184
215
|
|
|
185
216
|
struct YerbaResult yerba_document_reorder(struct Document *document,
|
|
186
|
-
const char *
|
|
217
|
+
const char *selector,
|
|
187
218
|
const char *by,
|
|
188
219
|
const char *order_csv);
|
|
189
220
|
|
|
190
221
|
struct YerbaResult yerba_document_sort_keys(struct Document *document,
|
|
191
|
-
const char *
|
|
222
|
+
const char *selector,
|
|
192
223
|
const char *order);
|
|
193
224
|
|
|
194
225
|
struct YerbaResult yerba_document_quote_style(struct Document *document,
|
|
195
|
-
const char *
|
|
226
|
+
const char *selector,
|
|
196
227
|
const char *key_style,
|
|
197
228
|
const char *value_style);
|
|
198
229
|
|
|
199
230
|
struct YerbaResult yerba_document_blank_lines(struct Document *document,
|
|
200
|
-
const char *
|
|
231
|
+
const char *selector,
|
|
201
232
|
uintptr_t count);
|
|
202
233
|
|
|
203
234
|
/**
|
|
@@ -224,14 +255,18 @@ void yerba_string_free(char *s);
|
|
|
224
255
|
|
|
225
256
|
void yerba_result_free(struct YerbaResult result);
|
|
226
257
|
|
|
258
|
+
struct YerbaNodeList yerba_document_nodes(const struct Document *document);
|
|
259
|
+
|
|
260
|
+
void yerba_node_list_free(struct YerbaNodeList list);
|
|
261
|
+
|
|
227
262
|
void yerba_get_result_free(struct YerbaGetResult result);
|
|
228
263
|
|
|
229
|
-
struct YerbaTypedList yerba_glob_get(const char *glob_pattern, const char *
|
|
264
|
+
struct YerbaTypedList yerba_glob_get(const char *glob_pattern, const char *selector);
|
|
230
265
|
|
|
231
|
-
struct YerbaTypedList yerba_document_get_all(const struct Document *document, const char *
|
|
266
|
+
struct YerbaTypedList yerba_document_get_all(const struct Document *document, const char *selector);
|
|
232
267
|
|
|
233
268
|
struct YerbaTypedList yerba_glob_find(const char *glob_pattern,
|
|
234
|
-
const char *
|
|
269
|
+
const char *selector,
|
|
235
270
|
const char *condition,
|
|
236
271
|
const char *select);
|
|
237
272
|
|