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.

Revisions

  1. rvause created this gist Jun 11, 2021.
    20 changes: 20 additions & 0 deletions neocities-switch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/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