-
-
Save jcwillox/a9b480f8d180d44368e7df2eb7009207 to your computer and use it in GitHub Desktop.
Oh yeah, I just happened to open GitHub right as you commented XD.
So, just checking, if I have
ch-0
ch-1
ch-2
Then is the correct folder to choose is ch-2
.
Which is what this should produce
Get-ChildItem "$env:LOCALAPPDATA\JetBrains\Toolbox\apps\PyCharm-P\ch-*" | Sort-Object -Descending | Select-Object -First 1
Also, thank you for creating this! This feature is a delightful addition to the JetBrains Toolbox UX.
Thanks for saying that always great to know people are getting value out of these things 😀
It's difficult to know due to how JetBrains enumerates.
For example:
If you have 5 versions installed, it may look something like this
ch-0
ch-1
ch-2
ch-3
ch-4
but if you uninstall 3 versions, you may end up with any combination of the remaining versions; In this case, any two versions.
ch-1
ch-3
now when a user installs a new version, it will be placed in ch-0:
ch-0
ch-1
ch-3
and another...
ch-0
ch-1
ch-2
ch-3
and for completeness sake, another version:
ch-0
ch-1
ch-2
ch-3
ch-4
this will be followed by ch-5, and so on.
The solution proposed won't fix all cases unfortunately.
You may want to look at grabbing the version number from each channel and selecting the largest, however it may be best from a UX standpoint to prompt the user for input in this scenario.
Righhht I totally understand what you mean now, thanks for that. Indeed automatically selecting it won't be a good option, I think prompting the user is a good way to go. I'll probably also add a flag like -DefaultChannel Release
which can check .channel.settings.json
to see if it's the release version and use that if found.
I've added the channel selection functionality, and also added the DefaultChannel
parameter so you can set a default channel to use and skip the selection prompt if it's found. So, hopefully, it should now be working for everyone.
Very nice job! Very helpful. Appreciate your effort.
Hi @jcwillox, thank you for this utility. I have now reinstalled my JetBrains tools using the Jetbrains Toolbox and am using this utility to add the entries to the context menu via the default method.
However, when trying to add the context menu entries using the Nircmd method, I am receiving this error when running the command:
➜ .\toolbox-context-menu.ps1 rider -UseNircmd -Force
Adding Context Menu for 'JetBrains Rider'
ACTION: Edit with JetBrains Rider (Files)
Join-Path : A positional parameter cannot be found that accepts argument '.shellLink'.
At C:\Users\Harry\AppData\Local\JetBrains\Toolbox\scripts\toolbox-context-menu.ps1:123 char:32
+ ... = Get-Content (Join-Path (Split-Path $ExePath) "../.." ".shellLink")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Join-Path], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.JoinPathCommand
Any ideas how this can be resolved?
Cheers!
Thanks! Pretty sure you just need to enable "shell scripts" in toolbox's settings and provide toolbox a location to put the shell scripts.
Hey, just thought I would put an updated comment on. Used the default method today and worked like a charm, found the dirs and applications and added / removed them super easy. Cheers!
Forgot to update the instructions comment at the top for toolbox 2.0, but better late than never, you can just use the direct install method now.
https://gist.github.com/jcwillox/a9b480f8d180d44368e7df2eb7009207?permalink_comment_id=4037552#gistcomment-4037552
I think I need a little more context/guidance for this one. First, the installation instructions needed an explicit parameter in modern pwsh:
❌
iwr https://gist.github.com/jcwillox/a9b480f8d180d44368e7df2eb7009207/raw/toolbox-context-menu.ps1 -o toolbox-context-menu.ps1
Invoke-WebRequest: Parameter cannot be processed because the parameter name 'o' is ambiguous. Possible matches include: -OperationTimeoutSeconds -OutFile -OutVariable -OutBuffer.
👇
✅
iwr https://gist.github.com/jcwillox/a9b480f8d180d44368e7df2eb7009207/raw/toolbox-context-menu.ps1 -OutFile toolbox-context-menu.ps1
Now, how exactly do I use it?
No matter the parameters, I get an error:
pwsh> .\toolbox-context-menu.ps1 webstorm
WARNING: no channels found in 'C:\Users\josch\AppData\Local\JetBrains\Toolbox\apps\Datalore'
WARNING: no channels found in 'C:\Users\josch\AppData\Local\JetBrains\Toolbox\apps\JetBrainsGateway'
Exception: D:\projects\toolbox-context-menu.ps1:101
Line |
101 | $binPath = Join-Path $versionPath "bin"
| ~~~~~~~~~~~~
| Cannot bind argument to parameter 'Path' because it is null.
Yep thanks, the download command is broken in my terminal now too, pretty bad of them to break that in a minor update, but anyhow, I've updated the download command.
That comment provides the usage instructions too, and it looks like you're not running the correct command, for toolbox v2, you should use something like this
.\toolbox-context-menu.ps1 -AppDir "C:\Users\%USERNAME%\AppData\Local\Programs\PyCharm Professional"
Also, thank you for creating this! This feature is a delightful addition to the JetBrains Toolbox UX.