chrisant996 / clink

Bash's powerful command line editing in cmd.exe
https://chrisant996.github.io/clink/
GNU General Public License v3.0
3.44k stars 135 forks source link

Proper way to update via scoop or clink update? #615

Closed maximunited closed 3 months ago

maximunited commented 3 months ago

So I installed clink via scoop. now with each new version I do the following: > scoop update > clink update

Then when I type clink info, the version does show the latest, but this version does not match the value of binaries or the scripts . It also shows an "old" version in the clink autorun show.

Example where version is 1.6.5, and other values are 1.6.3:

> clink autorun show                                                                        
Current AutoRun values

  Current user:

    native : "C:\Users\admin\scoop\apps\clink\1.6.3\clink.bat" inject --autorun
     wow64 : "C:\Users\admin\scoop\apps\clink\1.6.3\clink.bat" inject --autorun

  All users:

    native : <unset>
     wow64 : <unset>

and:

> clink info                                                                              
version  : 1.6.15.626c80
session  : 26160
injected : clink_dll_x64.dll
binaries : C:\Users\admin\scoop\apps\clink\1.6.3
state    : C:\Users\admin\AppData\Local\clink
log      : C:\Users\admin\AppData\Local\clink\clink.log
settings : C:\Users\admin\AppData\Local\clink\clink_settings
history  : C:\Users\admin\AppData\Local\clink\clink_history
scripts  : C:\Users\admin\scoop\apps\clink\1.6.3 ; C:\Users\admin\AppData\Local\clink ; C:\Users\admin\MyProgs\clink-completions;C:\Users\admin\MyProgs\clink-completions-extra\;C:\Users\admin\MyProgs\clink-gizmos\;C:\Users\admin\scoop\apps\clink-flex-prompt\0.17
inputrc  : %clink_inputrc%
             (unset)
         : state directory
             C:\Users\admin\AppData\Local\clink\.inputrc
             C:\Users\admin\AppData\Local\clink\_inputrc
         : %userprofile%
             C:\Users\admin\.inputrc
             C:\Users\admin\_inputrc
         : %localappdata%
             C:\Users\admin\AppData\Local\.inputrc
             C:\Users\admin\AppData\Local\_inputrc
         : %appdata%
             C:\Users\admin\AppData\Roaming\.inputrc
             C:\Users\admin\AppData\Roaming\_inputrc
         : %home%
             C:\Users\admin\.inputrc
             C:\Users\admin\_inputrc
system   : 10.0.19045.4412
codepage : 1252
keyboard langid : 8192
keyboard layout : 00000409

What is the "correct" way to update?

chrisant996 commented 3 months ago

This is something about scoop, which is interfering with Clink. It's also not normal behavior for scoop. You'll probably need to look for help in the scoop forums.

Specific details follow:

So I installed clink via scoop. now with each new version I do the following: > scoop update > clink update

Specifically how did install clink via scoop?

I tried it just now, and scoop installed it in ~\scoop\apps\clink\current\. There's no version number in the directory name.

I tried clink autorun install and it also doesn't have a version number in the directory name:

C:\Users\chrisant>clink autorun install
Current AutoRun values

  Current user:

    native : "C:\Users\chrisant\scoop\apps\clink\current\clink.bat" inject --autorun
     wow64 : "C:\Users\chrisant\scoop\apps\clink\current\clink.bat" inject --autorun

  All users:

    native : <unset>
     wow64 : <unset>

Clink successfully installed to run when cmd.exe starts (for current user).

Then when I type clink info, the version does show the latest, but this version does not match the value of binaries or the scripts . It also shows an "old" version in the clink autorun show.

Example where version is 1.6.5, and other values are 1.6.3:

...

What is the "correct" way to update?

The problem is that somehow scoop has gotten into an unusual state where it's putting the version number in the directory name. That breaks installing for AutoRun, since installing for AutoRun has to use the full pathname, which then gets invalidated with each new version.

How did scoop come to put the version number in the directory name?

That's something about scoop, not about Clink. I don't know much about scoop, so I can't directly help.

chrisant996 commented 3 months ago

I figured out what's going on:

You ran clink autorun install after Clink was already injected.

Injecting Clink defines an alias clink which points to the exact copy of Clink that was loaded -- and that ends up getting the version number in the directory name.

So, at this point, then simplest thing is just run %userprofile%\scoop\apps\clink\current\clink autorun install, and that should get you back into a normal state where scoop and clink can coexist fine.

(And I'll try to see if there's anything Clink can do to compensate for what scoop is doing, but no guarantees since Clink has no control over scoop.)

chrisant996 commented 3 months ago

I believe I found a way to compensate for what scoop is doing, so that the clink alias can end up pointing at scoop's "current" app directory symlink, instead of at the actual app version directory.

maximunited commented 3 months ago

Thanks for the workaround. Manually succeeded to overcome:

  1. scoop update clink
  2. clink autorun uninstall
  3. %userprofile%\scoop\apps\clink\current\clink autorun install
  4. %userprofile%\scoop\apps\clink\current\clink inject
chrisant996 commented 3 months ago

(Step 3 by itself is the key. The other steps weren't needed.)

maximunited commented 3 months ago

Actually I've tried that step separetly previously. Didnt help. Unless I must run it as a full path, not just clink autorun install

chrisant996 commented 3 months ago

Yes. I said you have to run it as the full exact path.

Literally run %userprofile%\scoop\apps\clink\current\clink autorun install

Running something else, such as clink autorun install, is not the same as running %userprofile%\scoop\apps\clink\current\clink autorun install.