Skip to content

Instantly share code, notes, and snippets.

@rvause
Created June 11, 2021 23:17
Show Gist options
  • Save rvause/ba34b97fbb7274c1373a29ca91ac37f0 to your computer and use it in GitHub Desktop.
Save rvause/ba34b97fbb7274c1373a29ca91ac37f0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# Simple script to switch Neocities configs for the CLI.
# Save tokens by copying "config" file to "config.<name>".
# Then use <name> to switch to that config.
# For example:
# $ mv ~/.config/neocities/config ~/.config/neocities/config.mysite
#
# With that in place you can now switch to it:
# $ neocities-switch mysite
#
# Repeat by logging in again and copying configs as many times you need
# to set up configs to switch to.
cp ~/.config/neocities/config.$1 ~/.config/neocities/config
if neocities list / | grep index.html > /dev/null 2>&1; then
echo "Switched to $1"
else
echo "Failed to authenticate $1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment