Whenever I run n latest, I generally always want all the previously-installed versions uninstalled. This is currently a painful process. I type n, try to remember the not-latest version numbers it shows on the screen, then I have to type n rm 6.8.0 etc. to remove each old version I may have.
Can there be an easier way to remove old versions? Perhaps in the version-selection screen, what I get by just typing n, highlighting a version and pressing delete would remove it? Or a command like n rm <6.8.1 or n rm <latest or somesuch?
+1
@taoyuan just fyi. Github supports +1, please use that functionality so we can keep issues clean, https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments
@EvanCarroll Got it. Thanks!
Here's a bash-specific solution, based on grepping for the escape codes in the output. The grep expression part before the pipe character drops any uninstalled versions, and the part after the pipe drops the currently active version. The output is then put all on one line and used as the argument to n rm.
n rm $(n ls | egrep -v $'\033\[90m|\033\[36m' | tr '\n' ' ')
We now have n prune which remove all old versions that are not active. I probably should update the docs. If this suits your needs I can close this issue.
Oh nice, I was on 2.1.3 so I didn't have that (at least not in the CLI help text IIRC).
Yeah it's on 2.1.7
This has been added as n prune and is in the README.
Most helpful comment
We now have
n prunewhich remove all old versions that are not active. I probably should update the docs. If this suits your needs I can close this issue.