Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 82 lines (64 sloc) 1.503 kB
36083c2 @dominictarr redo every thing as a bash script
authored
1 #! /usr/bin/env bash
2
3 name=$2
4 arg=$3
f51f26f @dominictarr add a fork remote with `gen add username`
authored
5
9e39593 @dominictarr use carpenter
authored
6 dir=$PWD
f51f26f @dominictarr add a fork remote with `gen add username`
authored
7 dirname=`basename $dir`
8
36083c2 @dominictarr redo every thing as a bash script
authored
9 if [ "$name" = -f ]; then
10 name=''
11 fi
05e0754 @dominictarr allow directory in templates
authored
12
36083c2 @dominictarr redo every thing as a bash script
authored
13 if [ "x$name" = x ]; then
f51f26f @dominictarr add a fork remote with `gen add username`
authored
14 name=$dirname
36083c2 @dominictarr redo every thing as a bash script
authored
15 arg=$2
16 fi
17
18 create () {
19 curl -X POST -u "$username:$auth" "https://api.github.com/user/repos" -d "{\"name\":\"$name\"}"
20 }
21
2a47f9f @dominictarr implement init command
authored
22 list () {
23 curl -u "$username:$auth" "https://api.github.com/user/repos"
36083c2 @dominictarr redo every thing as a bash script
authored
24 }
25
26 delete () {
27 if [ "$arg" != "-f" ]; then
28 echo WARNING YOU ABOUT TO DELETE $username/$name A YOUR SURE: Y/n?
29 read rusure
30 case $rusure in
31 Y) echo OKAY, $rusure DELETING: $username/$name ;;
32 *) exit 1 ;;
33 esac
34 fi
35 #gh DELETE "/repos/$username/$name"
36 curl -X DELETE -u "$username:$auth" "https://api.github.com/repos/$username/$name"
37 }
38
f51f26f @dominictarr add a fork remote with `gen add username`
authored
39 #gen add USER
40 #adds
36083c2 @dominictarr redo every thing as a bash script
authored
41 add () {
f51f26f @dominictarr add a fork remote with `gen add username`
authored
42 remote=origin
43
44 if [ "$dirname" != "$name" ]; then
45 [ "$arg" = -f ] && git remote rm $name >&2
6138001 @dominictarr use the right format for forks
authored
46 git remote add "$name" "git://github.com/$name/$dirname.git" >&2
f51f26f @dominictarr add a fork remote with `gen add username`
authored
47 else
48 [ "$arg" = -f ] && git remote rm origin >&2
49 git remote add origin "git@github.com:$username/$name.git" >&2
36083c2 @dominictarr redo every thing as a bash script
authored
50 fi
51 }
52
2a47f9f @dominictarr implement init command
authored
53 init () {
05e0754 @dominictarr allow directory in templates
authored
54 type="$1"
55 [ "x$type" = x ] && type=default
9e39593 @dominictarr use carpenter
authored
56
57 carpenter ~/.gen/$type/ . \
58 --appname gen -R --name "$name" --description "$description"
05e0754 @dominictarr allow directory in templates
authored
59
2a47f9f @dominictarr implement init command
authored
60 }
a3c4145 @dominictarr the is the right way to clone your own repo
authored
61
62 clone () {
63 repo="$1"
64 git clone "git@github.com:$username/$repo.git"
65 }
66
4d637c1 @dominictarr set up automatically
authored
67 init_gen () {
68 dir=$(dirname $(readlink -e $(which gen)))
69 cp -R "$dir"/template.gen ~/.gen
70 echo please edit ~/.gen/config
71 exit
72 }
73
74 if [ -e ~/.gen/config ]; then
75 . ~/.gen/config
76 else
77 init_gen
78 fi
79
36083c2 @dominictarr redo every thing as a bash script
authored
80 "$@"
81
Something went wrong with that request. Please try again.