Skip to content
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

document how to use powershell and elvish completions #2947

Open
jyn514 opened this issue Feb 4, 2024 · 2 comments
Open

document how to use powershell and elvish completions #2947

jyn514 opened this issue Feb 4, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@jyn514
Copy link
Collaborator

jyn514 commented Feb 4, 2024

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 try Invoke-Expression [String]$(cargo r -- util completion powershell) it complains that it doesn't like the using 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 #2945 (comment)

@martinvonz
Copy link
Owner

For elvish, maybe you ran into clap-rs/clap#4265? (Oh, look, I filed that issue. I have no memory of that.)

@PhilipMetzger PhilipMetzger added the documentation Improvements or additions to documentation label Feb 14, 2024
@c00t
Copy link

c00t commented Feb 22, 2024

Current Version

  • jj 0.14.0-8e4d1af98eccf1ed8a79a7ddf9500467aa7684f5
  • PowerShell 7.4.1

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants