yerba 0.7.6-arm-linux-gnu → 0.8.1-arm-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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -2
  3. data/exe/arm-linux-gnu/yerba +0 -0
  4. data/ext/yerba/include/yerba.h +8 -0
  5. data/ext/yerba/yerba.c +70 -8
  6. data/lib/yerba/3.2/yerba.so +0 -0
  7. data/lib/yerba/3.3/yerba.so +0 -0
  8. data/lib/yerba/3.4/yerba.so +0 -0
  9. data/lib/yerba/4.0/yerba.so +0 -0
  10. data/lib/yerba/map.rb +15 -10
  11. data/lib/yerba/node.rb +2 -2
  12. data/lib/yerba/sequence.rb +13 -1
  13. data/lib/yerba/version.rb +1 -1
  14. data/rust/Cargo.lock +2 -342
  15. data/rust/Cargo.toml +15 -6
  16. data/rust/src/commands/blank_lines.rs +2 -2
  17. data/rust/src/commands/directives.rs +4 -4
  18. data/rust/src/commands/get.rs +17 -10
  19. data/rust/src/commands/init.rs +4 -4
  20. data/rust/src/commands/insert.rs +6 -6
  21. data/rust/src/commands/location.rs +2 -2
  22. data/rust/src/commands/mate.rs +7 -7
  23. data/rust/src/commands/mod.rs +119 -90
  24. data/rust/src/commands/move_key.rs +9 -6
  25. data/rust/src/commands/quote_style.rs +4 -5
  26. data/rust/src/commands/rename.rs +3 -3
  27. data/rust/src/commands/schema.rs +6 -6
  28. data/rust/src/commands/selectors.rs +2 -2
  29. data/rust/src/commands/set.rs +12 -1
  30. data/rust/src/commands/sort.rs +36 -42
  31. data/rust/src/commands/sort_keys.rs +2 -2
  32. data/rust/src/commands/ui.rs +157 -0
  33. data/rust/src/commands/unique.rs +7 -7
  34. data/rust/src/commands/version.rs +13 -3
  35. data/rust/src/document/condition.rs +89 -32
  36. data/rust/src/document/delete.rs +6 -1
  37. data/rust/src/document/get.rs +94 -26
  38. data/rust/src/document/insert.rs +26 -0
  39. data/rust/src/document/mod.rs +73 -20
  40. data/rust/src/document/set.rs +91 -2
  41. data/rust/src/error.rs +17 -0
  42. data/rust/src/ffi.rs +76 -9
  43. data/rust/src/json.rs +10 -1
  44. data/rust/src/lib.rs +23 -7
  45. data/rust/src/main.rs +1 -0
  46. data/rust/src/quote_style.rs +12 -11
  47. data/rust/src/selector.rs +19 -3
  48. data/rust/src/syntax.rs +178 -26
  49. data/rust/src/yaml_writer.rs +4 -4
  50. data/rust/src/yerbafile.rs +30 -6
  51. metadata +3 -2
data/rust/Cargo.lock CHANGED
@@ -81,12 +81,6 @@ version = "1.0.102"
81
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
82
82
  checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
83
83
 
84
- [[package]]
85
- name = "atomic-waker"
86
- version = "1.1.2"
87
- source = "registry+https://github.com/rust-lang/crates.io-index"
88
- checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
89
-
90
84
  [[package]]
91
85
  name = "autocfg"
92
86
  version = "1.5.0"
@@ -138,12 +132,6 @@ version = "0.6.9"
138
132
  source = "registry+https://github.com/rust-lang/crates.io-index"
139
133
  checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
140
134
 
141
- [[package]]
142
- name = "bytes"
143
- version = "1.11.1"
144
- source = "registry+https://github.com/rust-lang/crates.io-index"
145
- checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
146
-
147
135
  [[package]]
148
136
  name = "cbindgen"
149
137
  version = "0.28.0"
@@ -322,15 +310,6 @@ version = "0.1.5"
322
310
  source = "registry+https://github.com/rust-lang/crates.io-index"
323
311
  checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
324
312
 
325
- [[package]]
326
- name = "form_urlencoded"
327
- version = "1.2.2"
328
- source = "registry+https://github.com/rust-lang/crates.io-index"
329
- checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
330
- dependencies = [
331
- "percent-encoding",
332
- ]
333
-
334
313
  [[package]]
335
314
  name = "fraction"
336
315
  version = "0.15.4"
@@ -341,34 +320,12 @@ dependencies = [
341
320
  "num",
342
321
  ]
343
322
 
344
- [[package]]
345
- name = "futures-channel"
346
- version = "0.3.32"
347
- source = "registry+https://github.com/rust-lang/crates.io-index"
348
- checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"
349
- dependencies = [
350
- "futures-core",
351
- "futures-sink",
352
- ]
353
-
354
323
  [[package]]
355
324
  name = "futures-core"
356
325
  version = "0.3.32"
357
326
  source = "registry+https://github.com/rust-lang/crates.io-index"
358
327
  checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
359
328
 
360
- [[package]]
361
- name = "futures-io"
362
- version = "0.3.32"
363
- source = "registry+https://github.com/rust-lang/crates.io-index"
364
- checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
365
-
366
- [[package]]
367
- name = "futures-sink"
368
- version = "0.3.32"
369
- source = "registry+https://github.com/rust-lang/crates.io-index"
370
- checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"
371
-
372
329
  [[package]]
373
330
  name = "futures-task"
374
331
  version = "0.3.32"
@@ -382,10 +339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
382
339
  checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
383
340
  dependencies = [
384
341
  "futures-core",
385
- "futures-io",
386
- "futures-sink",
387
342
  "futures-task",
388
- "memchr",
389
343
  "pin-project-lite",
390
344
  "slab",
391
345
  ]
@@ -454,88 +408,6 @@ version = "0.5.0"
454
408
  source = "registry+https://github.com/rust-lang/crates.io-index"
455
409
  checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
456
410
 
457
- [[package]]
458
- name = "http"
459
- version = "1.4.0"
460
- source = "registry+https://github.com/rust-lang/crates.io-index"
461
- checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
462
- dependencies = [
463
- "bytes",
464
- "itoa",
465
- ]
466
-
467
- [[package]]
468
- name = "http-body"
469
- version = "1.0.1"
470
- source = "registry+https://github.com/rust-lang/crates.io-index"
471
- checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
472
- dependencies = [
473
- "bytes",
474
- "http",
475
- ]
476
-
477
- [[package]]
478
- name = "http-body-util"
479
- version = "0.1.3"
480
- source = "registry+https://github.com/rust-lang/crates.io-index"
481
- checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
482
- dependencies = [
483
- "bytes",
484
- "futures-core",
485
- "http",
486
- "http-body",
487
- "pin-project-lite",
488
- ]
489
-
490
- [[package]]
491
- name = "httparse"
492
- version = "1.10.1"
493
- source = "registry+https://github.com/rust-lang/crates.io-index"
494
- checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
495
-
496
- [[package]]
497
- name = "hyper"
498
- version = "1.9.0"
499
- source = "registry+https://github.com/rust-lang/crates.io-index"
500
- checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca"
501
- dependencies = [
502
- "atomic-waker",
503
- "bytes",
504
- "futures-channel",
505
- "futures-core",
506
- "http",
507
- "http-body",
508
- "httparse",
509
- "itoa",
510
- "pin-project-lite",
511
- "smallvec",
512
- "tokio",
513
- "want",
514
- ]
515
-
516
- [[package]]
517
- name = "hyper-util"
518
- version = "0.1.20"
519
- source = "registry+https://github.com/rust-lang/crates.io-index"
520
- checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
521
- dependencies = [
522
- "base64",
523
- "bytes",
524
- "futures-channel",
525
- "futures-util",
526
- "http",
527
- "http-body",
528
- "hyper",
529
- "ipnet",
530
- "libc",
531
- "percent-encoding",
532
- "pin-project-lite",
533
- "socket2",
534
- "tokio",
535
- "tower-service",
536
- "tracing",
537
- ]
538
-
539
411
  [[package]]
540
412
  name = "icu_collections"
541
413
  version = "2.2.0"
@@ -666,12 +538,6 @@ dependencies = [
666
538
  "rustversion",
667
539
  ]
668
540
 
669
- [[package]]
670
- name = "ipnet"
671
- version = "2.12.0"
672
- source = "registry+https://github.com/rust-lang/crates.io-index"
673
- checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
674
-
675
541
  [[package]]
676
542
  name = "is_terminal_polyfill"
677
543
  version = "1.70.2"
@@ -715,7 +581,6 @@ dependencies = [
715
581
  "percent-encoding",
716
582
  "referencing",
717
583
  "regex-syntax",
718
- "reqwest",
719
584
  "serde",
720
585
  "serde_json",
721
586
  "uuid-simd",
@@ -778,17 +643,6 @@ version = "2.8.0"
778
643
  source = "registry+https://github.com/rust-lang/crates.io-index"
779
644
  checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
780
645
 
781
- [[package]]
782
- name = "mio"
783
- version = "1.2.0"
784
- source = "registry+https://github.com/rust-lang/crates.io-index"
785
- checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
786
- dependencies = [
787
- "libc",
788
- "wasi",
789
- "windows-sys",
790
- ]
791
-
792
646
  [[package]]
793
647
  name = "num"
794
648
  version = "0.4.3"
@@ -1050,40 +904,6 @@ version = "0.8.10"
1050
904
  source = "registry+https://github.com/rust-lang/crates.io-index"
1051
905
  checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
1052
906
 
1053
- [[package]]
1054
- name = "reqwest"
1055
- version = "0.12.28"
1056
- source = "registry+https://github.com/rust-lang/crates.io-index"
1057
- checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
1058
- dependencies = [
1059
- "base64",
1060
- "bytes",
1061
- "futures-channel",
1062
- "futures-core",
1063
- "futures-util",
1064
- "http",
1065
- "http-body",
1066
- "http-body-util",
1067
- "hyper",
1068
- "hyper-util",
1069
- "js-sys",
1070
- "log",
1071
- "percent-encoding",
1072
- "pin-project-lite",
1073
- "serde",
1074
- "serde_json",
1075
- "serde_urlencoded",
1076
- "sync_wrapper",
1077
- "tokio",
1078
- "tower",
1079
- "tower-http",
1080
- "tower-service",
1081
- "url",
1082
- "wasm-bindgen",
1083
- "wasm-bindgen-futures",
1084
- "web-sys",
1085
- ]
1086
-
1087
907
  [[package]]
1088
908
  name = "rowan"
1089
909
  version = "0.16.1"
@@ -1192,18 +1012,6 @@ dependencies = [
1192
1012
  "serde",
1193
1013
  ]
1194
1014
 
1195
- [[package]]
1196
- name = "serde_urlencoded"
1197
- version = "0.7.1"
1198
- source = "registry+https://github.com/rust-lang/crates.io-index"
1199
- checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
1200
- dependencies = [
1201
- "form_urlencoded",
1202
- "itoa",
1203
- "ryu",
1204
- "serde",
1205
- ]
1206
-
1207
1015
  [[package]]
1208
1016
  name = "slab"
1209
1017
  version = "0.4.12"
@@ -1216,16 +1024,6 @@ version = "1.15.1"
1216
1024
  source = "registry+https://github.com/rust-lang/crates.io-index"
1217
1025
  checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
1218
1026
 
1219
- [[package]]
1220
- name = "socket2"
1221
- version = "0.6.3"
1222
- source = "registry+https://github.com/rust-lang/crates.io-index"
1223
- checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
1224
- dependencies = [
1225
- "libc",
1226
- "windows-sys",
1227
- ]
1228
-
1229
1027
  [[package]]
1230
1028
  name = "stable_deref_trait"
1231
1029
  version = "1.2.1"
@@ -1249,15 +1047,6 @@ dependencies = [
1249
1047
  "unicode-ident",
1250
1048
  ]
1251
1049
 
1252
- [[package]]
1253
- name = "sync_wrapper"
1254
- version = "1.0.2"
1255
- source = "registry+https://github.com/rust-lang/crates.io-index"
1256
- checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
1257
- dependencies = [
1258
- "futures-core",
1259
- ]
1260
-
1261
1050
  [[package]]
1262
1051
  name = "synstructure"
1263
1052
  version = "0.13.2"
@@ -1298,19 +1087,6 @@ dependencies = [
1298
1087
  "zerovec",
1299
1088
  ]
1300
1089
 
1301
- [[package]]
1302
- name = "tokio"
1303
- version = "1.52.3"
1304
- source = "registry+https://github.com/rust-lang/crates.io-index"
1305
- checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
1306
- dependencies = [
1307
- "libc",
1308
- "mio",
1309
- "pin-project-lite",
1310
- "socket2",
1311
- "windows-sys",
1312
- ]
1313
-
1314
1090
  [[package]]
1315
1091
  name = "toml"
1316
1092
  version = "0.8.23"
@@ -1352,76 +1128,6 @@ version = "0.1.2"
1352
1128
  source = "registry+https://github.com/rust-lang/crates.io-index"
1353
1129
  checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
1354
1130
 
1355
- [[package]]
1356
- name = "tower"
1357
- version = "0.5.3"
1358
- source = "registry+https://github.com/rust-lang/crates.io-index"
1359
- checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
1360
- dependencies = [
1361
- "futures-core",
1362
- "futures-util",
1363
- "pin-project-lite",
1364
- "sync_wrapper",
1365
- "tokio",
1366
- "tower-layer",
1367
- "tower-service",
1368
- ]
1369
-
1370
- [[package]]
1371
- name = "tower-http"
1372
- version = "0.6.10"
1373
- source = "registry+https://github.com/rust-lang/crates.io-index"
1374
- checksum = "68d6fdd9f81c2819c9a8b0e0cd91660e7746a8e6ea2ba7c6b2b057985f6bcb51"
1375
- dependencies = [
1376
- "bitflags",
1377
- "bytes",
1378
- "futures-util",
1379
- "http",
1380
- "http-body",
1381
- "pin-project-lite",
1382
- "tower",
1383
- "tower-layer",
1384
- "tower-service",
1385
- "url",
1386
- ]
1387
-
1388
- [[package]]
1389
- name = "tower-layer"
1390
- version = "0.3.3"
1391
- source = "registry+https://github.com/rust-lang/crates.io-index"
1392
- checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
1393
-
1394
- [[package]]
1395
- name = "tower-service"
1396
- version = "0.3.3"
1397
- source = "registry+https://github.com/rust-lang/crates.io-index"
1398
- checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
1399
-
1400
- [[package]]
1401
- name = "tracing"
1402
- version = "0.1.44"
1403
- source = "registry+https://github.com/rust-lang/crates.io-index"
1404
- checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
1405
- dependencies = [
1406
- "pin-project-lite",
1407
- "tracing-core",
1408
- ]
1409
-
1410
- [[package]]
1411
- name = "tracing-core"
1412
- version = "0.1.36"
1413
- source = "registry+https://github.com/rust-lang/crates.io-index"
1414
- checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
1415
- dependencies = [
1416
- "once_cell",
1417
- ]
1418
-
1419
- [[package]]
1420
- name = "try-lock"
1421
- version = "0.2.5"
1422
- source = "registry+https://github.com/rust-lang/crates.io-index"
1423
- checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
1424
-
1425
1131
  [[package]]
1426
1132
  name = "unicode-ident"
1427
1133
  version = "1.0.24"
@@ -1434,18 +1140,6 @@ version = "0.2.6"
1434
1140
  source = "registry+https://github.com/rust-lang/crates.io-index"
1435
1141
  checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
1436
1142
 
1437
- [[package]]
1438
- name = "url"
1439
- version = "2.5.8"
1440
- source = "registry+https://github.com/rust-lang/crates.io-index"
1441
- checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
1442
- dependencies = [
1443
- "form_urlencoded",
1444
- "idna",
1445
- "percent-encoding",
1446
- "serde",
1447
- ]
1448
-
1449
1143
  [[package]]
1450
1144
  name = "utf8_iter"
1451
1145
  version = "1.0.4"
@@ -1491,21 +1185,6 @@ version = "0.8.0"
1491
1185
  source = "registry+https://github.com/rust-lang/crates.io-index"
1492
1186
  checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64"
1493
1187
 
1494
- [[package]]
1495
- name = "want"
1496
- version = "0.3.1"
1497
- source = "registry+https://github.com/rust-lang/crates.io-index"
1498
- checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
1499
- dependencies = [
1500
- "try-lock",
1501
- ]
1502
-
1503
- [[package]]
1504
- name = "wasi"
1505
- version = "0.11.1+wasi-snapshot-preview1"
1506
- source = "registry+https://github.com/rust-lang/crates.io-index"
1507
- checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
1508
-
1509
1188
  [[package]]
1510
1189
  name = "wasip2"
1511
1190
  version = "1.0.3+wasi-0.2.9"
@@ -1537,16 +1216,6 @@ dependencies = [
1537
1216
  "wasm-bindgen-shared",
1538
1217
  ]
1539
1218
 
1540
- [[package]]
1541
- name = "wasm-bindgen-futures"
1542
- version = "0.4.71"
1543
- source = "registry+https://github.com/rust-lang/crates.io-index"
1544
- checksum = "96492d0d3ffba25305a7dc88720d250b1401d7edca02cc3bcd50633b424673b8"
1545
- dependencies = [
1546
- "js-sys",
1547
- "wasm-bindgen",
1548
- ]
1549
-
1550
1219
  [[package]]
1551
1220
  name = "wasm-bindgen-macro"
1552
1221
  version = "0.2.121"
@@ -1613,16 +1282,6 @@ dependencies = [
1613
1282
  "semver",
1614
1283
  ]
1615
1284
 
1616
- [[package]]
1617
- name = "web-sys"
1618
- version = "0.3.98"
1619
- source = "registry+https://github.com/rust-lang/crates.io-index"
1620
- checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa"
1621
- dependencies = [
1622
- "js-sys",
1623
- "wasm-bindgen",
1624
- ]
1625
-
1626
1285
  [[package]]
1627
1286
  name = "windows-link"
1628
1287
  version = "0.2.1"
@@ -1772,8 +1431,9 @@ dependencies = [
1772
1431
 
1773
1432
  [[package]]
1774
1433
  name = "yerba"
1775
- version = "0.7.6"
1434
+ version = "0.8.1"
1776
1435
  dependencies = [
1436
+ "anstyle-query",
1777
1437
  "cbindgen",
1778
1438
  "clap",
1779
1439
  "glob",
data/rust/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "yerba"
3
- version = "0.7.6"
3
+ version = "0.8.1"
4
4
  edition = "2021"
5
5
  authors = ["Marco Roth <marco.roth@intergga.ch>"]
6
6
  description = "YAML Editing and Refactoring with Better Accuracy"
@@ -18,21 +18,30 @@ crate-type = ["cdylib", "staticlib", "rlib"]
18
18
  [[bin]]
19
19
  name = "yerba"
20
20
  path = "src/main.rs"
21
+ required-features = ["cli"]
22
+
23
+ [features]
24
+ default = ["cli"]
25
+ cli = ["dep:clap", "dep:indoc", "dep:anstyle-query", "glob", "schema"]
26
+ glob = ["dep:glob", "dep:rayon"]
27
+ schema = ["dep:jsonschema"]
21
28
 
22
29
  [dependencies]
23
30
  yaml_parser = "0.3"
24
31
  rowan = "0.16"
25
- glob = "0.3"
32
+ glob = { version = "0.3", optional = true }
26
33
  serde = { version = "1", features = ["derive"] }
27
34
  yaml_serde = "0.10"
28
35
  serde_json = { version = "1", features = ["preserve_order"] }
29
- clap = { version = "4", features = ["derive"] }
30
- indoc = "2"
31
- rayon = "1"
32
- jsonschema = "0.29"
36
+ clap = { version = "4", features = ["derive"], optional = true }
37
+ anstyle-query = { version = "1", optional = true }
38
+ indoc = { version = "2", optional = true }
39
+ rayon = { version = "1", optional = true }
40
+ jsonschema = { version = "0.29", default-features = false, optional = true }
33
41
 
34
42
  [build-dependencies]
35
43
  cbindgen = "0.28"
36
44
 
37
45
  [dev-dependencies]
46
+ indoc = "2"
38
47
  tempfile = "3"
@@ -37,9 +37,9 @@ impl Args {
37
37
  } else if let Ok(count) = self.first.parse::<usize>() {
38
38
  ("", count)
39
39
  } else {
40
- use super::color::*;
40
+ use super::ui;
41
41
 
42
- eprintln!("{RED}Error:{RESET} expected a number for blank line count, got '{}'", self.first);
42
+ eprintln!("{} expected a number for blank line count, got '{}'", ui::failure("Error:"), self.first);
43
43
 
44
44
  std::process::exit(1);
45
45
  };
@@ -1,3 +1,4 @@
1
+ use super::ui;
1
2
  use std::sync::LazyLock;
2
3
 
3
4
  use indoc::indoc;
@@ -35,14 +36,13 @@ pub struct Args {
35
36
  impl Args {
36
37
  pub fn run(self) {
37
38
  if !self.ensure && !self.remove {
38
- use super::color::*;
39
- eprintln!("{RED}Error:{RESET} specify --ensure or --remove");
39
+ use super::ui;
40
+ eprintln!("{} specify --ensure or --remove", ui::failure("Error:"));
40
41
  std::process::exit(1);
41
42
  }
42
43
 
43
44
  if self.ensure && self.remove {
44
- use super::color::*;
45
- eprintln!("{RED}Error:{RESET} --ensure and --remove are mutually exclusive");
45
+ eprintln!("{} --ensure and --remove are mutually exclusive", ui::failure("Error:"));
46
46
  std::process::exit(1);
47
47
  }
48
48
 
@@ -1,3 +1,4 @@
1
+ use super::ui;
1
2
  use std::process;
2
3
  use std::sync::LazyLock;
3
4
 
@@ -62,6 +63,16 @@ impl Args {
62
63
  condition.clone()
63
64
  });
64
65
 
66
+ if let Some(condition) = &normalized_condition {
67
+ if let Err(error) = yerba::validate_item_condition(condition) {
68
+ use super::ui;
69
+
70
+ eprintln!("{} {}", ui::failure("Error:"), error);
71
+
72
+ process::exit(1);
73
+ }
74
+ }
75
+
65
76
  let search_path_string = search_path.to_selector_string();
66
77
  let mut all_results: Vec<serde_json::Value> = Vec::new();
67
78
  let files = resolve_files(&self.file);
@@ -75,9 +86,7 @@ impl Args {
75
86
  continue;
76
87
  }
77
88
 
78
- use super::color::*;
79
-
80
- eprintln!("{RED}Error:{RESET} selector \"{}\" not found in {}", self.selector, self.file);
89
+ eprintln!("{} selector \"{}\" not found in {}", ui::failure("Error:"), self.selector, self.file);
81
90
 
82
91
  show_similar_selectors(&self.file, &document, &self.selector);
83
92
  process::exit(1);
@@ -100,8 +109,7 @@ impl Args {
100
109
  break;
101
110
  }
102
111
 
103
- use super::color::*;
104
- eprintln!("{RED}Error:{RESET} select field \"{}\" not found in {}", field.trim(), self.file);
112
+ eprintln!("{} select field \"{}\" not found in {}", ui::failure("Error:"), field.trim(), self.file);
105
113
  show_similar_selectors(&self.file, &document, &full_selector);
106
114
  process::exit(1);
107
115
  }
@@ -114,7 +122,7 @@ impl Args {
114
122
 
115
123
  let (values, selectors, lines): (Vec<yaml_serde::Value>, Vec<String>, Vec<usize>) = if select_fields.is_some() {
116
124
  if let Some(condition) = &normalized_condition {
117
- let triples = document.filter_with_selectors(&search_path_string, condition);
125
+ let triples = document.filter_with_selectors(&search_path_string, condition).unwrap_or_default();
118
126
  let (values, rest): (Vec<_>, Vec<_>) = triples.into_iter().map(|(v, s, l)| (v, (s, l))).unzip();
119
127
  let (selectors, lines): (Vec<_>, Vec<_>) = rest.into_iter().unzip();
120
128
 
@@ -129,7 +137,7 @@ impl Args {
129
137
  (values, selectors, lines)
130
138
  }
131
139
  } else if let Some(condition) = &normalized_condition {
132
- (document.filter(&search_path_string, condition), Vec::new(), Vec::new())
140
+ (document.filter(&search_path_string, condition).unwrap_or_default(), Vec::new(), Vec::new())
133
141
  } else {
134
142
  (document.get_values(&search_path_string), Vec::new(), Vec::new())
135
143
  };
@@ -180,10 +188,9 @@ impl Args {
180
188
  }
181
189
 
182
190
  if is_glob && all_results.is_empty() && normalized_condition.is_none() {
183
- use super::color::*;
184
-
185
191
  eprintln!(
186
- "{RED}Error:{RESET} selector \"{}\" not found in any of the {} files matching \"{}\"",
192
+ "{} selector \"{}\" not found in any of the {} files matching \"{}\"",
193
+ ui::failure("Error:"),
187
194
  self.selector,
188
195
  files.len(),
189
196
  self.file
@@ -3,13 +3,13 @@ use std::process;
3
3
 
4
4
  use indoc::indoc;
5
5
 
6
- use super::color::*;
6
+ use super::ui;
7
7
 
8
8
  pub fn run() {
9
9
  let filename = "Yerbafile";
10
10
 
11
11
  if Path::new(filename).exists() {
12
- eprintln!("🧉 {YELLOW}{BOLD}Yerbafile already exists.{RESET}");
12
+ eprintln!("🧉 {}", ui::pending("Yerbafile already exists."));
13
13
  process::exit(1);
14
14
  }
15
15
 
@@ -81,9 +81,9 @@ pub fn run() {
81
81
  "#};
82
82
 
83
83
  std::fs::write(filename, content).unwrap_or_else(|error| {
84
- eprintln!("{RED}Error:{RESET} writing Yerbafile: {}", error);
84
+ eprintln!("{} writing Yerbafile: {}", ui::failure("Error:"), error);
85
85
  process::exit(1);
86
86
  });
87
87
 
88
- eprintln!("🧉 {GREEN}{BOLD}Created Yerbafile{RESET}");
88
+ eprintln!("🧉 {}", ui::success("Created Yerbafile"));
89
89
  }