GithubHelp home page GithubHelp logo

git-goodbye's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

git-goodbye's Issues

finish sh implementation

I really suck at sh, this is how far I got:

#!/bin/sh

set -e

panic() {
  >&2 echo "$1"
  exit 2
}

while [[ $# -gt 0 ]]; do
  arg="$1"
  shift

  case $arg in
    --branch)
      CREATE_BRANCH=true
      ;;
    --push)
      PUSH=true
      ;;
    --ALL)
      CREATE_BRANCH=true
      PUSH=true
      ;;
    *)
      cat 1>&2 <<EOF
error: unknown option '$arg'.

USAGE: #{arg[0]} [<options>]

OPTIONS:
  --branch: create a new orphan branch
  --push: push new orphan branch
  --all: all of the above"
EOF
      exit 1
      ;;
  esac
done

if [ -n "$PUSH" ] && [ -z "$CREATE_BRANCH" ]; then
  panic "--push is pointless without --branch"
fi

USER_RE="s\-ol"
NEW_REMOTE_RE="git\.s\-ol.nu"
NEW_SLUG_RE=".*git\.s\-ol.nu[:/]public/(.*)"
NEW_HTTP="git.s-ol.nu"

REMOTES=$(git remote -v)

TMP=$(git remote -v | grep "github\.com[:/]$GITHUB_USER_RE.*(push)$" | awk '{print $1 " " $2}')
read OLD_REMOTE OLD_URL <<<$TMP
# not working yet:
OLD_SLUG=$(sed -E "s|.*github\.com[:/]($GITHUB_USER_RE/.*)|\1|" <<<$OLD_URL)

TMP=$(git remote -v | grep "$NEW_REMOTE_RE.*(push)$" | awk '{print $1 " " $2}')
read NEW_REMOTE NEW_URL <<<$TMP
# not working yet:
NEW_SLUG=$(sed -E "s|$NEW_SLUG_RE$|\1|" <<<$NEW_URL)

echo "moving github.com/$OLD_SLUG [$OLD_REMOTE] -> $NEW_HTTP/$NEW_SLUG [$NEW_REMOTE]"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.