File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22# -*- coding: UTF-8 -*-
33# # helper script to 'git push --set-upstream' current branch
4+ # # -r, --remote <string> Name of the remote to push to [default: origin]
5+ # GENERATED_CODE: start
6+ # Default values
7+ _remote=origin
8+
9+ # Converting long-options into short ones
10+ for arg in " $@ " ; do
11+ shift
12+ case " $arg " in
13+ " --remote" ) set -- " $@ " " -r" ;;
14+ * ) set -- " $@ " " $arg "
15+ esac
16+ done
17+
18+ function print_illegal() {
19+ echo Unexpected flag in command line \" $@ \"
20+ }
21+
22+ # Parsing flags and arguments
23+ while getopts ' hr:' OPT; do
24+ case $OPT in
25+ h) sed -ne ' s/^## \(.*\)/\1/p' $0
26+ exit 1 ;;
27+ r) _remote=$OPTARG ;;
28+ \? ) print_illegal $@ >&2 ;
29+ echo " ---"
30+ sed -ne ' s/^## \(.*\)/\1/p' $0
31+ exit 1
32+ ;;
33+ esac
34+ done
35+ # GENERATED_CODE: end
36+
437current=$( git rev-parse --abbrev-ref HEAD)
5- echo " git push --set-upstream origin ${current} ? (press ENTER to accept)"
38+ echo " git push --set-upstream $_remote ${current} ? (press ENTER to accept)"
639read
7- git push --set-upstream origin ${current}
40+ git push --set-upstream $_remote ${current}
You can’t perform that action at this time.
0 commit comments