Skip to content

Commit 1f0d8a5

Browse files
fix(stdlib): Add missing functions from 0.28 release (#1553)
* fix(stdlib): Add missing functions from 0.28 release Missing functions: `split_path`, `basename`, `dirname` * Add changelog * Fix changelog file * Fix split_path tests
1 parent 8ba2c11 commit 1f0d8a5

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

changelog.d/1553.fix.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fixed an issue where `split_path`, `basename`, `dirname` had not been added to VRL's standard
2+
library and, therefore, appeared to be missing and were inaccessible in the `0.28` release.
3+
4+
authors: thomasqueirozb

src/stdlib/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ pub fn all() -> Vec<Box<dyn Function>> {
423423
Box::new(Array),
424424
Box::new(Assert),
425425
Box::new(AssertEq),
426+
Box::new(BaseName),
426427
Box::new(Boolean),
427428
Box::new(Camelcase),
428429
Box::new(Ceil),
@@ -436,15 +437,16 @@ pub fn all() -> Vec<Box<dyn Function>> {
436437
Box::new(DecodeCharset),
437438
Box::new(DecodeGzip),
438439
Box::new(DecodeLz4),
440+
Box::new(DecodeMimeQ),
439441
Box::new(DecodePercent),
440442
Box::new(DecodePunycode),
441-
Box::new(DecodeMimeQ),
442443
Box::new(DecodeSnappy),
443444
Box::new(DecodeZlib),
444445
Box::new(DecodeZstd),
445446
Box::new(Decrypt),
446447
Box::new(DecryptIp),
447448
Box::new(Del),
449+
Box::new(DirName),
448450
Box::new(DnsLookup),
449451
Box::new(Downcase),
450452
Box::new(EncodeBase16),
@@ -581,6 +583,7 @@ pub fn all() -> Vec<Box<dyn Function>> {
581583
Box::new(Snakecase),
582584
Box::new(Slice),
583585
Box::new(Split),
586+
Box::new(SplitPath),
584587
Box::new(StartsWith),
585588
Box::new(String),
586589
Box::new(StripAnsiEscapeCodes),

src/stdlib/split_path.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ impl Function for SplitPath {
4242
&[
4343
Example {
4444
title: "Split path with trailing slash",
45-
source: r#"split_path!("/home/user/")"#,
45+
source: r#"split_path("/home/user/")"#,
4646
result: Ok(r#"["/", "home", "user"]"#),
4747
},
4848
Example {
4949
title: "Split path from file path",
50-
source: r#"split_path!("/home/user")"#,
50+
source: r#"split_path("/home/user")"#,
5151
result: Ok(r#"["/", "home", "user"]"#),
5252
},
5353
Example {
5454
title: "Split path from root",
55-
source: r#"split_path!("/")"#,
55+
source: r#"split_path("/")"#,
5656
result: Ok(r#"["/"]"#),
5757
},
5858
Example {
5959
title: "Empty path returns empty array",
60-
source: r#"split_path!("")"#,
60+
source: r#"split_path("")"#,
6161
result: Ok("[]"),
6262
},
6363
]

0 commit comments

Comments
 (0)