github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/integration-cli/fixtures/auth/docker-credential-shell-test (about) 1 #!/bin/bash 2 3 set -e 4 5 case $1 in 6 "store") 7 in=$(</dev/stdin) 8 server=$(echo "$in" | jq --raw-output ".ServerURL" | sha1sum - | awk '{print $1}') 9 10 username=$(echo "$in" | jq --raw-output ".Username") 11 password=$(echo "$in" | jq --raw-output ".Secret") 12 echo "{ \"Username\": \"${username}\", \"Secret\": \"${password}\" }" > $TEMP/$server 13 ;; 14 "get") 15 in=$(</dev/stdin) 16 server=$(echo "$in" | sha1sum - | awk '{print $1}') 17 if [[ ! -f $TEMP/$server ]]; then 18 echo "credentials not found in native keychain" 19 exit 1 20 fi 21 payload=$(<$TEMP/$server) 22 echo "$payload" 23 ;; 24 "erase") 25 in=$(</dev/stdin) 26 server=$(echo "$in" | sha1sum - | awk '{print $1}') 27 rm -f $TEMP/$server 28 ;; 29 *) 30 echo "unknown credential option" 31 exit 1 32 ;; 33 esac