8ed6dd5fc4c5e9b28d0f8a87f72c0bbe5f628580
- Author
- Daniel Bolton <dbb@9y.com>
- Committer
- Daniel Bolton <dbb@9y.com>
- Date
Message
Add functions for new GH repos.
Diff
1diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
2index 1eb3381136818b82b1915cb5113d1877fc0907a5..e5f59097deee36b17156a45f5549b21aa7601c4a 100644
3--- a/plugins/github/github.plugin.zsh
4+++ b/plugins/github/github.plugin.zsh
5@@ -4,3 +4,44 @@ if [ "$commands[(I)hub]" ]; then
6 # eval `hub alias -s zsh`
7 function git(){hub "$@"}
8 fi
9+
10+# Functions #################################################################
11+
12+# https://github.com/dbb
13+
14+# These are taken directly from the instructions you see after you create a new
15+# repo. As the names imply, new_gh() assumes you're starting from scratch in a
16+# directory named after the repo (this name is the only argument it takes), and
17+# exist_gh() assumes that you've already initialized git in the given directory
18+# (again, the only argument).
19+# set up a new repo
20+
21+new_gh() { # [NAME_OF_REPO]
22+ repo = $1
23+
24+ name=$( igit config user.name )
25+ email=$( git config user.email )
26+ user=$( git config github.user )
27+
28+ mkdir "$repo"
29+ cd "$repo"
30+ git init
31+ touch README
32+ git add README
33+ git commit -m 'Initial commit.'
34+ git remote add origin git@github.com:${user}/${name}.git
35+ git push -u origin master
36+}
37+
38+exist_gh() { # [DIRECTORY]
39+ cd "$1"
40+ name=$( git config user.name )
41+ email=$( git config user.email )
42+ user=$( git config github.user )
43+
44+ git remote add origin git@github.com:${user}/${name}.git
45+ git push -u origin master
46+}
47+
48+# End Functions #############################################################
49+