Sdkman-cli: Introduce quiet mode for install

Created on 24 Dec 2012  Â·  10Comments  Â·  Source: sdkman/sdkman-cli

I am trying to use GVM with Travis-CI but failed because the install command requires user input.

language: java

jdk:
  - openjdk7
  - oraclejdk7

before_install:
 - rm -Rf /home/travis/.gvm  # remove previous versions of GVM
 - curl -s get.gvmtool.net | bash
 - source "/home/travis/.gvm/bin/gvm-init.sh"
 - gvm install grails 2.2.0

script: grails test-app

This ends up waiting for a user input.

Do you want to use grails 2.2.0 now? (Y/n): 

It would be nice if there was a parameter to switch off user input (quiet mode)

gvm install -q grails 2.2.0

Most helpful comment

There should be a command line option for this, because it is useful, and many other package managers offer this. Writing to a config makes it more complex than necessary.

All 10 comments

How about a config setting (rather than a command line option)?

- echo "gvm_install=Y" >> $GVM_DIR/etc/config
- echo "gvm_use=Y" >> $GVM_DIR/etc/config

(I'm not saying that works, just a suggestion for implementation, since there are no command line options yet in gvm, but there is a config file.)

That works for me.

Note, the flag has changed a few times since this commit. You must now use _gvm_auto_answer_
So, to quick edit your config:

echo "gvm_auto_answer=true" >> ~/.gvm/etc/config

All details of the config are on the site at http://gvmtool.net under Configuration.

I used this with good effect:
sed -i -e 's/sdkman_auto_answer=false/sdkman_auto_answer=true/g' /root/.sdkman/etc/config

The upgrade should already take care of this for you when migrating from GVM to sdkman.

Thanks for the note. I did a clean install of the latest sdkman; no upgrade involved. I still had to do this to get it to run with a puppet manifest. Thanks for the feedback.

Ah sorry, misread your comment. Yes, setting the config to true will
automatically answer the defaults on your behalf.
On Mon, 19 Oct 2015 at 22:10, Stephen Taylor [email protected]
wrote:

Thanks for the note. I did a clean install of the latest sdkman; no
upgrade involved. I still had to do this to get it to run with a puppet
manifest. Thanks for the feedback.

—
Reply to this email directly or view it on GitHub
https://github.com/sdkman/sdkman-cli/issues/101#issuecomment-149348526.

I haven't seen this documented anywhere, but this seems to work if you want to run a single command:

$ sdk install grails 3.0.9 < /dev/null

Result:

Found a previously downloaded grails 3.0.9 archive. Not downloading it again...

Installing: grails 3.0.9
Done installing!

Do you want grails 3.0.9 to be set as default? (Y/n): 
Setting grails 3.0.9 as default.

There should be a command line option for this, because it is useful, and many other package managers offer this. Writing to a config makes it more complex than necessary.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Omnipresent picture Omnipresent  Â·  6Comments

dayja78 picture dayja78  Â·  6Comments

edmondo1984 picture edmondo1984  Â·  6Comments

ncowles picture ncowles  Â·  3Comments

pshirshov picture pshirshov  Â·  5Comments