Created
May 11, 2017 00:31
-
-
Save chiefy/e8450771c33b059dfbbfc9846e29369b to your computer and use it in GitHub Desktop.
testing cmd.io stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user=${1:-chiefy} | |
hostname=localhost | |
port=2223 | |
ssh="ssh ${user}@${hostname} -p ${port}" | |
cmd_name=tester | |
test_cmd=$(cat <<'EOD' | |
#!cmd.io alpine bash | |
#!/bin/bash | |
echo | |
env | |
echo | |
i=1 | |
echo "args:"; for arg in $@; do printf "${i}-${arg} "; i=$((i+1)); done; echo | |
EOD | |
) | |
${ssh} :rm ${cmd_name} | |
echo "${test_cmd}"|${ssh} :create ${cmd_name} | |
token=$(${ssh} :tokens new ${cmd_name}) | |
${ssh} :access ${cmd_name} grant ${token} | |
echo | |
echo "no args -----------------------------------" | |
curl -sS "http://${token}@localhost:8080/run/${user}/${cmd_name}" | |
echo "-------------------------------------------" | |
echo | |
echo "args query --------------------------------" | |
curl -sS "http://${token}@localhost:8080/run/${user}/${cmd_name}?args=hi%20how+yes%20asdf+some+other%20ones" | |
echo "-------------------------------------------" | |
echo | |
echo "non-args query ----------------------------" | |
curl -sS "http://${token}@localhost:8080/run/${user}/${cmd_name}?val=true&something=else&whatever=false+maybe" | |
echo "-------------------------------------------" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment