choosenim
choosenim copied to clipboard
Add support for custom hooks
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.
Why not simply have your tool run choosenim show
to check the active version?
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.