chrisant996 / clink

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

Does installscripts search subdirectories? #444

Closed HeyItsJono closed 1 year ago

HeyItsJono commented 1 year ago

I just have a quick question RE: clink installscripts, I was hoping to find out if this automatically searches subdirectories of the specified directory.

For example, if I run clink installscripts %APPDATA%/Cmder/config, where config has .lua scripts in it, but also a subfolder clink-gizmos with scripts in it, will I need to separately run clink installscripts %APPDATA%/Cmder/config/clink-gizmos, or would doing this mean that the scripts in clink-gizmos are parsed twice?

chrisant996 commented 1 year ago

No. It loads scripts from the listed directories.

If it recursed that would break things and run scripts at load time that shouldn't be run, such as modules\ and completions\ scripts.

HeyItsJono commented 1 year ago

Thanks, this is odd, as I currently have a situation where Cmder/vendor/clink-completions is being loaded, however it does not exist in my installed clink scripts. Ctrl+X Ctrl+Z shows:

USER\AppData\Roaming\Cmder\vendor
USER\AppData\Roaming\Cmder\vendor\clink
USER\AppData\Roaming\Cmder\config
USER\AppData\Roaming\Cmder\config\clink-gizmos

But USER\AppData\Roaming\Cmder\vendor\clink-completions is also being loaded.

EDIT:

Sorry, seems it's Cmder's doing. In USER\AppData\Roaming\Cmder\vendor\clink.lua:

local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/'
-- Execute '.init.lua' first to ensure package.path is set properly
dofile(completions_dir..'.init.lua')

Thanks for your help