b8ade4815adb42c21bfc8e2b415bde4b295d2c71
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh
2deleted file mode 100644
3index 1b35a064628625497cd67c2163c00d02a4c35cff..0000000000000000000000000000000000000000
4--- a/plugins/deb/deb.plugin.zsh
5+++ /dev/null
6@@ -1,13 +0,0 @@
7-# Aliases
8-alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
9- --no-gui --disable-columns search" # search package
10-alias ad="sudo apt-get update" # update packages lists
11-alias au="sudo apt-get update && \
12- sudo apt-get dselect-upgrade" # upgrade packages
13-alias ai="sudo apt-get install" # install package
14-alias ar="sudo apt-get remove --purge && \
15- sudo apt-get autoremove --purge" # remove package
16-alias ap="apt-cache policy" # apt policy
17-alias av="apt-cache show" # show package info
18-alias acs="apt-cache search" # search package
19-alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
20diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
21index f8865a41210d3318525e867734cffd7cbe5bb7b2..09771881dfc255f8c984626e9c6c21b3b87d474a 100644
22--- a/plugins/debian/debian.plugin.zsh
23+++ b/plugins/debian/debian.plugin.zsh
24@@ -1,53 +1,143 @@
25-# https://github.com/dbbolton/
26+# Authors:
27+# https://github.com/AlexBio
28+# https://github.com/dbb
29 #
30 # Debian-related zsh aliases and functions for zsh
31
32+# Use aptitude if installed, or apt-get if not.
33+# You can just set apt_pref='apt-get' to override it.
34+if [[ -e $( which aptitude ) ]]; then
35+ apt_pref='aptitude'
36+else
37+ apt_pref='apt-get'
38+fi
39+
40+# Use sudo by default if it's installed
41+if [[ -e $( which sudo ) ]]; then
42+ use_sudo=1
43+fi
44
45 # Aliases ###################################################################
46+# These are for more obscure uses of apt-get and aptitude that aren't covered
47+# below.
48+alias ag='apt-get'
49+alias at='aptitude'
50
51 # Some self-explanatory aliases
52-alias afs='apt-file search --regexp'
53+alias acs="apt-cache search"
54 alias aps='aptitude search'
55-alias apsrc='apt-get source'
56-alias apv='apt-cache policy'
57+alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
58+ --no-gui --disable-columns search" # search package
59
60-alias apdg='su -c "aptitude update && aptitude safe-upgrade"'
61-alias apud='su -c "aptitude update"'
62-alias apug='su -c "aptitude safe-upgrade"'
63+# apt-file
64+alias afs='apt-file search --regexp'
65
66+
67+# These are apt-get only
68+alias asrc='apt-get source'
69+alias ap='apt-cache policy'
70+
71+# superuser operations ######################################################
72+if [[ $use_sudo -eq 1 ]]; then
73+# commands using sudo #######
74+ alias aac="sudo $apt_pref autoclean"
75+ alias abd="sudo $apt_pref build-dep"
76+ alias ac="sudo $apt_pref clean"
77+ alias ad="sudo $apt_pref update"
78+ alias adg="sudo $apt_pref update && sudo $apt_pref upgrade"
79+ alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
80+ alias afu='sudo apt-file update'
81+ alias ag="sudo $apt_pref upgrade"
82+ alias ai="sudo $apt_pref install"
83+ alias ap="sudo $apt_pref purge"
84+ alias ar="sudo $apt_pref remove"
85+
86+ # apt-get only
87+ alias ads="sudo $apt_pref dselect-upgrade"
88+
89+ # Install all .deb files in the current directory.
90+ # Warning: you will need to put the glob in single quotes if you use:
91+ # glob_subst
92+ alias di='sudo dpkg -i ./*.deb'
93+
94+ # Remove ALL kernel images and headers EXCEPT the one in use
95+ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
96+ ?not(~n`uname -r`))'
97+
98+
99+# commands using su #########
100+else
101+ alias aac='su -ls "'"$apt_pref"' autoclean" root'
102+ abd() {
103+ cmd="su -lc '$apt_pref build-dep $@' root"
104+ print "$cmd"
105+ eval "$cmd"
106+ }
107+ alias ac='su -ls "'"$apt_pref"' clean" root'
108+ alias ad='su -lc "'"$apt_pref"' update" root'
109+ alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root'
110+ alias adu='su -lc "'"$apt_pref"' update && aptitude dist-upgrade" root'
111+ alias afu='su -lc "apt-file update"'
112+ alias ag='su -lc "'"$apt_pref"' safe-upgrade" root'
113+ ai() {
114+ cmd="su -lc 'aptitude -P install $@' root"
115+ print "$cmd"
116+ eval "$cmd"
117+ }
118+ ap() {
119+ cmd="su -lc '$apt_pref -P purge $@' root"
120+ print "$cmd"
121+ eval "$cmd"
122+ }
123+ ar() {
124diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
125index b50ac4d850da1c202d07a190b93ccc90949dd3fa..9b0d54602fcfe03edc072921cbe2134908250286 100644
126--- a/plugins/github/github.plugin.zsh
127+++ b/plugins/github/github.plugin.zsh
128@@ -3,3 +3,58 @@ if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
129 # eval `hub alias -s zsh`
130 function git(){hub "$@"}
131 fi
132+
133+# Functions #################################################################
134+
135+# https://github.com/dbb
136+
137+
138+# empty_gh [NAME_OF_REPO]
139+#
140+# Use this when creating a new repo from scratch.
141+empty_gh() { # [NAME_OF_REPO]
142+ repo = $1
143+ ghuser=$( git config github.user )
144+
145+ mkdir "$repo"
146+ cd "$repo"
147+ git init
148+ touch README
149+ git add README
150+ git commit -m 'Initial commit.'
151+ git remote add origin git@github.com:${ghuser}/${repo}.git
152+ git push -u origin master
153+}
154+
155+# new_gh [DIRECTORY]
156+#
157+# Use this when you have a directory that is not yet set up for git.
158+# This function will add all non-hidden files to git.
159+new_gh() { # [DIRECTORY]
160+ cd "$1"
161+ ghuser=$( git config github.user )
162+
163+ git init
164+ # add all non-dot files
165+ print '.*'"\n"'*~' >> .gitignore
166+ git add ^.*
167+ git commit -m 'Initial commit.'
168+ git remote add origin git@github.com:${ghuser}/${repo}.git
169+ git push -u origin master
170+}
171+
172+# exist_gh [DIRECTORY]
173+#
174+# Use this when you have a git repo that's ready to go and you want to add it
175+# to your GitHub.
176+exist_gh() { # [DIRECTORY]
177+ cd "$1"
178+ name=$( git config user.name )
179+ ghuser=$( git config github.user )
180+
181+ git remote add origin git@github.com:${ghuser}/${repo}.git
182+ git push -u origin master
183+}
184+
185+# End Functions #############################################################
186+