mkdir -p ~/.histsync
for file in {'bash-preexec.sh','histsync-client'}; do
    echo Downloading, $file
    curl "http://histsync.io/download-client/$file" > ~/.histsync/$file;
done

read -p "Github username: " username
read -p "API key (from histsync.io profile): " key
echo '# Add the following lines in your .bashrc / .bash_profiles'
echo '# ============'
echo '# HistSync'
echo 'source ~/.bash-preexec.sh'
echo 'preexec() {'
echo "    ~/histsync/histsync-client --api-key $key --user $username \"\$1\" --log-file ~/.histsync/log;"
echo '}'

mkdir -p ~/.histsync
for file in {'bash-preexec.sh','histsync-client'}; do
    curl "http://histsync.io/download-client/$file" > ~/.histsync/$file;
done

echo '# Add the following lines in your .bashrc / .bash_profiles'
echo '# ============'
echo '# HistSync'
echo 'source ~/.bash-preexec.sh'
echo 'preexec() {'
echo '    ~/histsync/histsync-client --api-key {{hist_sync_api_key}} --user {{github_username}} "$1" --log-file ~/.histsync/log;'
echo '}'

Revert "Request api key and username from user" (doesn't work with piping)
Revert "Request api key and username from user" (doesn't work with
piping)

This reverts commit 5fec0cc9cb02c2456eadd8594c3c71fa37d61a00.
