Actions
Arvswitch » History » Revision 8
« Previous |
Revision 8/10
(diff)
| Next »
Peter Amstutz, 03/03/2016 07:00 PM
Arvswitch¶
Usage¶
$ arvswitch Switch Arvados environment conf Usage: arvswitch name Available confs: ... $ arvsave Save current Arvados environment variables to conf file Usage: arvsave name $ arvrm Delete Arvados environment conf Usage: arvrm name $ arvboxswitch Switch Arvbox environment conf Usage: arvboxswitch name Your current container is: arvbox Available confs: ... $ arvopen Open Arvados uuid in browser Usage: arvopen uuid
Code¶
Copy this into your .bashrc
or create a new file called something like "arvswitch.sh" and add the line ". arvswitch.sh" to your .bashrc
HISTIGNORE=$HISTIGNORE:'export ARVADOS_API_TOKEN=*' arvswitch() { if [[ -n "$1" ]] ; then if [[ -f $HOME/.config/arvados/$1.conf ]] ; then unset ARVADOS_API_HOST_INSECURE for a in $(cat $HOME/.config/arvados/$1.conf) ; do export $a ; done echo "Switched to $1" else echo "$1 unknown" fi else echo "Switch Arvados environment conf" echo "Usage: arvswitch name" echo "Available confs:" $((cd $HOME/.config/arvados && ls --indicator-style=none *.conf) | rev | cut -c6- | rev) fi } arvsave() { if [[ -n "$1" ]] ; then touch $HOME/.config/arvados/$1.conf chmod 0600 $HOME/.config/arvados/$1.conf env | grep ARVADOS_ > $HOME/.config/arvados/$1.conf else echo "Save current Arvados environment variables to conf file" echo "Usage: arvsave name" fi } arvrm() { if [[ -n "$1" ]] ; then if [[ -f $HOME/.config/arvados/$1.conf ]] ; then rm $HOME/.config/arvados/$1.conf else echo "$1 unknown" fi else echo "Delete Arvados environment conf" echo "Usage: arvrm name" fi } arvboxswitch() { if [[ -n "$1" ]] ; then if [[ -d $HOME/.arvbox/$1 ]] ; then export ARVBOX_CONTAINER=$1 echo "Arvbox switched to $1" else echo "$1 unknown" fi else if test -z "$ARVBOX_CONTAINER" ; then ARVBOX_CONTAINER=arvbox fi echo "Switch Arvbox environment conf" echo "Usage: arvboxswitch name" echo "Your current container is: $ARVBOX_CONTAINER" echo "Available confs:" $(cd $HOME/.arvbox && ls --indicator-style=none) fi } arvopen() { if [[ -n "$1" ]] ; then xdg-open https://curover.se/$1 else echo "Open Arvados uuid in browser" echo "Usage: arvopen uuid" fi }
Alternatives¶
See DJB's envdir
Updated by Peter Amstutz almost 9 years ago · 10 revisions