Open davidosomething opened 8 years ago
That's a good point. I'm concerned, however, that using the .nvmrc
file is so implicit that that output would have real value.
However, I suppose then "not using --silent" would be the recommendation?
fwiw, you can also do nvm use >/dev/null
if you don't want any output.
I have no problem(the output) when I'm using nvm use 6 --silent
, nvm use 4 --silent
, is this still a problem here?
@peterdavehello it is only when using a .nvmrc file, not when manually setting the version
I think the semantics of --silent
are not necessarily "do not output anything" - since you can use >/dev/null
to actually suppress all output.
for me, I would expect the --silent
flag to suppress all console output, which it still doesn't do if you're using nvm use
in a directory with an .nvmrc.
I work on a project with lots of different sub modules using different versions of node, so I would like to just alias my cd
command to cd $1 && nvm use --silent
. That way I don't have to think about switching every time I move to a new dir.
nvm use >/dev/null
produces the same console output for me. So that doesn't seem to circumvent the issue.
> /dev/null 2>&1
is how you suppress all console output in all unix commands; it wouldn't really make sense nor be part of the unix philosophy to expect that functionality to be duplicated in-project.
In other words, nvm use >/dev/null 2>&1
will suppress all output.
FYI for anyone coming up on this like I did, I ended up using this as a one-liner:
ACTUAL_NODE_PATH=$(cd "$TARGET" > /dev/null; nvm which --silent)
It runs
nvm_rc_version
, which echos "Found ..." and "Now using..." All output should be silenced (or introduce --silence-all ornvm --quiet use
or something)