Skip to content

Add format() experimental function #779

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

Merged
merged 5 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 56 additions & 5 deletions dsc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 21 additions & 8 deletions dsc_lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions dsc_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ chrono = "0.4"
clap = { version = "4.5", features = ["derive"] }
derive_builder ="0.20"
indicatif = "0.17"
jsonschema = { version = "0.29", default-features = false }
jsonschema = { version = "0.30", default-features = false }
linked-hash-map = "0.5"
num-traits = "0.2"
regex = "1.11"
rt-format = "0.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package seems reasonable enough, but I'll point out that it's last release was 3 years ago, and it has this note:

Is stable API a must-have? If so, you might consider the alternatives. This crate is still not at version 1.0, which means that the API is still not completely stable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just something to consider, dyn-fmt appears more recently updated than the other two contenders (rt-format as above and the similarly named dynfmt last published 4 years ago).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm not saying it's better, I'm just looking into it.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at the variety of options listed in the rt-format repository. Maybe will switch to dyn-fmt in the future. Since this is experimental, we can leave it as-is for now.

rust-i18n = { version = "3.1" }
# reqwest = { version = "0.12.8", features = ["native-tls"], default-features = false }
schemars = { version = "0.8", features = ["preserve_order"] }
Expand All @@ -29,13 +30,13 @@ serde_yaml = { version = "0.9" }
thiserror = "2.0"
security_context_lib = { path = "../security_context_lib" }
semver = "1.0"
tokio = { version = "1.43", features = ["full"] }
tokio = { version = "1.44", features = ["full"] }
tracing = "0.1"
tracing-indicatif = { version = "0.3" }
tree-sitter = "0.25"
tree-sitter-rust = "0.24"
tree-sitter-dscexpression = { path = "../tree-sitter-dscexpression" }
uuid = { version = "1.15", features = ["v4"] }
uuid = { version = "1.16", features = ["v4"] }
which = "7.0"

[dev-dependencies]
Expand Down
7 changes: 7 additions & 0 deletions dsc_lib/locales/en-us.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ notFound = "Environment variable not found"
[functions.if]
conditionNotBoolean = "Condition is not a boolean"

[functions.format]
experimental = "`format()` function is experimental"
formatInvalid = "First `format()` argument must be a string"
numberTooLarge = "Number is too large"
invalidArgType = "Unsupported argument type"
invalidFormatString = "Invalid format string"

[functions.int]
invalidInput = "invalid input string"
parseStringError = "unable to parse string to int"
Expand Down
Loading
Loading