I work with multiple nim packages, and wrote a tiny shell script that turned out to be very useful for me. I just thought I might share it here, if anyone cares:
function niminstall {
if [[ -e ~/proj/nim/$1 ]]; then
pushd -q ~/proj/nim/$1
yes | nimble install
popd -q
else
echo "project $1 not found"
fi
}
All it does is, to execute nimble install in the argument project. The path ~/proj/nim/$1 might be adjusted to your path of nim projects though. The use case is the following:
I work on project A, and A depends on B. I need to fix something in B, but I want to see the effect in A. So I do for example the following in the folder of A:
niminstall B && nim c -r A.nim
Before the script I always had to change back into A install it, and then go back. Btw the yes program just spams "y" lines on stdout, to answer all questions of nimble with yes. In the beginning I also wanted to have the autocompletion screpted, so that I can get my project names on tab completion, but it seems I am not smart enought for that yet.
For those interested: I plan to solve this in Nimble by implementing what is described in this comment: https://github.com/nim-lang/nimble/issues/240#issuecomment-255557708.
Btw the yes program just spams "y" lines on stdout, to answer all questions of nimble with yes.
Nimble has a flag for this: nimble install -y.