I have this nushell function:
def rebase-diff [oldtip:string,newtip:string] {
git range-diff $oldtip...$newtip | save -f rebase-diff.txt | start ./rebase-diff.txt
}
When I run it I get:
× Data cannot be accessed with a cell path
╭─[C:\Users\Yathindu.Hettiarachc\AppData\Roaming\nushell\config.nu:869:1]
869 │ def rebase-diff [oldtip:string,newtip:string] {
870 │ git range-diff $oldtip...$newtip | save -f rebase-diff.txt | start ./rebase-diff.txt
· ┬
· ╰── string doesn't support cell paths
871 │ }
╰────
So nushell thinks I'm using .
but I just want it to just use ...
literally.
Is there a way to escape .
?
A string value, when used literally, generally requires quoting. However, Nu allows dropping the quotes if it only contains "word characters" and is not used in a command position. These are called bare strings.
The dot .
is not a word character, so some sort of quoting is necessary. To combine it with the values of the variables, you could use
+
:
git range-diff ($oldtip + '...' + $newtip) | …
$
:
git range-diff $'($oldtip)...($newtip)' | …