String interpolation with table fields surround's elements with square brackets #14911
Closed
Description
Describe the bug
On my first attempt to convert a bash/powershell script to nushell which became my new shell on windows recently,
I run into an edge case where having a table of elements and trying to interpolate its elements into a string together surrounded them with square brackets for an unclear reason. I search all other the available documentation and google results for a solution and I couldn't find one. Am I doing something wrong here or is this an actual bug?
How to reproduce
In this example:
let url = "git@github.com:Souvlaki42/astro-sitemap-issue.git"
let parsed = $url | parse --regex '(?s)git@(?P<domain>[^:]+):(?P<path>.+)\.git'
print $parsed.domain $parsed.path # prints "github.com" and "Souvlaki42/astro-sitemap-issue"
print $"($parsed.domain)($parsed.path)" # prints "[github.com][Souvlaki42/astro-sitemap-issue]"
Expected behavior
In this example however:
let name = "Nushell"
print $"My favorite shell is ($name)" # prints "My favorite shell is Nushell"
let fullname = {"first": "Steve", "last": "Jobs"}
print $"My full name is ($fullname.first) ($fullname.last)" # prints "My full name is Steve Jobs"
Configuration
key | value |
---|---|
version | 0.101.0 |
major | 0 |
minor | 101 |
patch | 0 |
branch | |
commit_hash | fb26109 |
build_os | windows-x86_64 |
build_target | x86_64-pc-windows-msvc |
rust_version | rustc 1.81.0 (eeb90cda1 2024-09-04) |
rust_channel | 1.81.0-x86_64-pc-windows-msvc |
cargo_version | cargo 1.81.0 (2dbb1af80 2024-08-20) |
build_time | 2024-12-22 15:52:28 +00:00 |
build_rust_channel | release |
allocator | mimalloc |
features | default, sqlite, trash |
installed_plugins | formats 0.100.0, gstat 0.100.0, inc 0.100.0, polars 0.100.0, query 0.100.0 |