choosenim icon indicating copy to clipboard operation
choosenim copied to clipboard

Add support for custom hooks

Open PMunch opened this issue 5 years ago • 2 comments

Some tools require to be built against the current Nim version, one example of this is nimlsp which will give error messages for the version of Nim it is built with. It would be nice if choosenim had some system by which you could add custom scripts to be run when changing version or installing a new one. This way tools like nimlsp could automatically match up with the version of Nim currently being used.

The feature should be fairly simple to implement, simply create a folder named hooks, with subfolders for each hook. Then simply run all the scripts in each folder when that action is triggered within the program.

PMunch avatar Nov 06 '19 09:11 PMunch

Why not simply have your tool run choosenim show to check the active version?

dom96 avatar Oct 01 '20 22:10 dom96

Not quite sure what you mean. My usecase for this is nimlsp, it compiles into a version that only works properly for one version of Nim. I wanted choosenim <version> to switch between pre-compiled versions of nimlsp, or build the new required version, similar to what it does for Nim. This would mean that my developer tools are up to date with the Nim version I've chosen. Of course I could wrap this in a tool that calls choosenim, but that breaks down as soon as I have more than one tool which requires this.

PMunch avatar Oct 02 '20 06:10 PMunch