Open jyn514 opened 6 months ago
For elvish, maybe you ran into https://github.com/clap-rs/clap/issues/4265? (Oh, look, I filed that issue. I have no memory of that.)
Current Version
On powershell, only the .
operator can be used (instead of Invoke-Expression
), but I believe there are some encoding issue with the current implementation, here is my current profile file:
# jj completion
$jjc = [ScriptBlock]::Create([system.String]::Join("`n",$(jj util completion powershell).split("`n")))
# can't do this
# $jjc = [ScriptBlock]::Create($(jj util completion powershell))
. $jjc
I can't create a ScriptBlock
just from $(jj util completion powershell)
.
But writing the script to a file and then using the .
operator is fine:
jj util completion powershell > jjc.ps1
. .\jjc.ps1
This could be a clap issue as well?
Update
Aha! That problem has been solved by clap. (found by jj user actually)
i added support for these in #2945 but wasn't able to figure out how to actually use them in the respective shells. it would be nice to document how to do that; i don't use these shells so i don't know.
Invoke-Expression
looks like the right thing for powershell, but when i tryInvoke-Expression [String]$(cargo r -- util completion powershell)
it complains that it doesn't like theusing
token. i'm not sure if that's specific to powershell on windows or something like that?elvish i couldn't get working at all, it complained about invalid syntax. i think ubuntu might package an ancient version or something like that.
_Originally posted by @jyn514 in https://github.com/martinvonz/jj/pull/2945#discussion_r1477437430_