Project

General

Profile

Actions

Arvswitch » History » Revision 5

« Previous | Revision 5/10 (diff) | Next »
Peter Amstutz, 11/16/2015 01:52 PM


Arvswitch

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
        else
            echo "$1 unknown" 
        fi
    else
        echo "Switch Arvados environment conf" 
        echo "Usage: arvswitch name" 
    fi
}

arvlist() {
    (cd $HOME/.config/arvados && ls --indicator-style=none *.conf) | rev | cut -c6- | rev
}

arvsave() {
    if [[ -n "$1" ]] ; then
        env | grep ARVADOS_ > $HOME/.config/arvados/$1.conf
        chmod 0600 $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
}

Updated by Peter Amstutz about 9 years ago · 10 revisions