zomgit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +2 -0
- data/LICENSE +22 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/bin/zomgit +12 -0
- data/lib/zomgit.rb +81 -0
- data/lib/zomgit/commands.rb +18 -0
- data/lib/zomgit/commands/find.rb +49 -0
- data/lib/zomgit/commands/status.rb +248 -0
- data/lib/zomgit/concerns/findable.rb +135 -0
- data/lib/zomgit/exceptions.rb +37 -0
- data/lib/zomgit/helpers/file_helper.rb +17 -0
- data/lib/zomgit/helpers/rainbow_helper.rb +46 -0
- data/lib/zomgit/persistor.rb +51 -0
- data/lib/zomgit/version.rb +3 -0
- data/share/commands/add.zsh +92 -0
- data/share/commands/branch.zsh +11 -0
- data/share/commands/checkout.zsh +18 -0
- data/share/commands/clone.zsh +18 -0
- data/share/commands/commit.zsh +7 -0
- data/share/commands/diff.zsh +89 -0
- data/share/commands/log.zsh +11 -0
- data/share/commands/push.zsh +3 -0
- data/share/commands/reset.zsh +80 -0
- data/share/commands/status.zsh +30 -0
- data/share/zomgit.zsh +14 -0
- data/zomgit.gemspec +22 -0
- metadata +129 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
gd() {
|
2
|
+
local gitopts
|
3
|
+
local fileopts
|
4
|
+
local options
|
5
|
+
local files
|
6
|
+
|
7
|
+
gitopts=()
|
8
|
+
options=()
|
9
|
+
|
10
|
+
if (( $# == 0 )); then
|
11
|
+
fileopts="."
|
12
|
+
options=( --filter modified )
|
13
|
+
else
|
14
|
+
local opts
|
15
|
+
|
16
|
+
gitopts=( $(echo "${@}" | command grep -o -E "(--( (.*)))$" | command sed -E "s/^-- ?//") )
|
17
|
+
opts=( $(echo "$@" | sed -E "s/(.*)(--( .*))$/\1/g") )
|
18
|
+
|
19
|
+
# Remove the git options from the regular options array
|
20
|
+
set -- "${opts[@]}"
|
21
|
+
|
22
|
+
#
|
23
|
+
# Parse ZOMGit options
|
24
|
+
#
|
25
|
+
local opt_filter
|
26
|
+
local opt_greedy
|
27
|
+
local opt_refine
|
28
|
+
|
29
|
+
opt_filter=( modified )
|
30
|
+
opt_greedy=()
|
31
|
+
opt_refine=()
|
32
|
+
|
33
|
+
zparseopts -K -D f:=opt_filter -filter:=opt_filter g=opt_greedy G=opt_greedy -greedy=opt_greedy -no-greedy=opt_greedy r=opt_refine -refine=opt_refine
|
34
|
+
|
35
|
+
local filter=${opt_filter[${#opt_filter}]}
|
36
|
+
local greedy=${opt_greedy[${#opt_greedy}]}
|
37
|
+
local refine=${#opt_refine}
|
38
|
+
|
39
|
+
if [[ "${filter}" != "" ]]; then
|
40
|
+
if ! [[ "${filter}" =~ "modified|staged" ]]; then
|
41
|
+
echo "${fg[red]}You can only diff files that are either\ntracked or in the staging area!${reset_color}"
|
42
|
+
return 1
|
43
|
+
fi
|
44
|
+
|
45
|
+
options=( $options --filter $filter )
|
46
|
+
fi
|
47
|
+
|
48
|
+
if [[ "${greedy}" != "" && "${greedy}" =~ "G|no" ]]; then
|
49
|
+
options=( $options $greedy )
|
50
|
+
fi
|
51
|
+
|
52
|
+
if (( $refine > 0 )); then
|
53
|
+
options=( $options --refine )
|
54
|
+
fi
|
55
|
+
|
56
|
+
if (( $# == 0 )); then
|
57
|
+
fileopts="."
|
58
|
+
else
|
59
|
+
fileopts="$@"
|
60
|
+
fi
|
61
|
+
fi
|
62
|
+
|
63
|
+
if (( ${#gitopts} > 0 )); then
|
64
|
+
typeset -U gitopts
|
65
|
+
fi
|
66
|
+
|
67
|
+
files="$(zomgit find ${options[@]} ${fileopts} 2>&1)"
|
68
|
+
local exitcode=$?
|
69
|
+
|
70
|
+
if (( ${exitcode} > 0 )); then
|
71
|
+
echo "${fg[red]}${files}${reset_color}"
|
72
|
+
return ${exitcode}
|
73
|
+
fi
|
74
|
+
|
75
|
+
local params
|
76
|
+
params=( diff ${gitopts[@]} $(echo ${files} | command tr '\n' ' ') )
|
77
|
+
|
78
|
+
if type hub > /dev/null; then
|
79
|
+
command hub ${params[@]}
|
80
|
+
elif type gh > /dev/null; then
|
81
|
+
command gh ${params[@]}
|
82
|
+
else
|
83
|
+
command git ${params[@]}
|
84
|
+
fi
|
85
|
+
}
|
86
|
+
|
87
|
+
gdc() {
|
88
|
+
gd --filter staged ${@} -- --cached
|
89
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
grs() {
|
2
|
+
local gitopts
|
3
|
+
local fileopts
|
4
|
+
local options
|
5
|
+
local files
|
6
|
+
|
7
|
+
gitopts=()
|
8
|
+
options=( --filter staged )
|
9
|
+
|
10
|
+
if (( $# == 0 )); then
|
11
|
+
fileopts="."
|
12
|
+
else
|
13
|
+
local opts
|
14
|
+
|
15
|
+
gitopts=( $(echo "${@}" | command grep -o -E "(--( (.*)))$" | command sed -E "s/^-- ?//") )
|
16
|
+
opts=( $(echo "$@" | sed -E "s/(.*)(--( .*))$/\1/g") )
|
17
|
+
|
18
|
+
# Remove the git options from the regular options array
|
19
|
+
set -- "${opts[@]}"
|
20
|
+
|
21
|
+
#
|
22
|
+
# Parse ZOMGit options
|
23
|
+
#
|
24
|
+
local opt_greedy
|
25
|
+
local opt_refine
|
26
|
+
|
27
|
+
opt_greedy=()
|
28
|
+
opt_refine=()
|
29
|
+
|
30
|
+
zparseopts -K -D g=opt_greedy G=opt_greedy -greedy=opt_greedy -no-greedy=opt_greedy r=opt_refine -refine=opt_refine
|
31
|
+
|
32
|
+
local greedy=${opt_greedy[${#opt_greedy}]}
|
33
|
+
local refine=${#opt_refine}
|
34
|
+
|
35
|
+
if [[ "${greedy}" != "" && "${greedy}" =~ "G|no" ]]; then
|
36
|
+
options=( $options $greedy )
|
37
|
+
fi
|
38
|
+
|
39
|
+
if (( $refine > 0 )); then
|
40
|
+
options=( $options --refine )
|
41
|
+
fi
|
42
|
+
|
43
|
+
if (( $# == 0 )); then
|
44
|
+
fileopts="."
|
45
|
+
else
|
46
|
+
fileopts="$@"
|
47
|
+
fi
|
48
|
+
fi
|
49
|
+
|
50
|
+
if (( ${#gitopts} == 0 )); then
|
51
|
+
gitopts=( -q )
|
52
|
+
else
|
53
|
+
typeset -U gitopts
|
54
|
+
fi
|
55
|
+
|
56
|
+
files="$(zomgit find ${options[@]} ${fileopts} 2>&1)"
|
57
|
+
local exitcode=$?
|
58
|
+
|
59
|
+
if (( ${exitcode} > 0 )); then
|
60
|
+
echo "${fg[red]}${files}${reset_color}"
|
61
|
+
return ${exitcode}
|
62
|
+
fi
|
63
|
+
|
64
|
+
local params
|
65
|
+
params=( reset ${gitopts[@]} $(echo ${files} | command tr '\n' ' ') )
|
66
|
+
|
67
|
+
if type hub > /dev/null; then
|
68
|
+
command hub ${params[@]}
|
69
|
+
elif type gh > /dev/null; then
|
70
|
+
command gh ${params[@]}
|
71
|
+
else
|
72
|
+
command git ${params[@]}
|
73
|
+
fi
|
74
|
+
|
75
|
+
zomgit status
|
76
|
+
}
|
77
|
+
|
78
|
+
grsH() {
|
79
|
+
command git reset --hard HEAD
|
80
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
gs() {
|
2
|
+
local gitopts
|
3
|
+
local opts
|
4
|
+
|
5
|
+
gitopts=( $(echo "${@}" | command grep -o -E "(--( (.*)))$" | command sed -E "s/^-- ?//") )
|
6
|
+
opts=( $(echo "$@" | sed -E "s/(.*)(--( .*))$/\1/g") )
|
7
|
+
|
8
|
+
# Remove the git options from the regular options array
|
9
|
+
set -- "${opts[@]}"
|
10
|
+
|
11
|
+
#
|
12
|
+
# Parse ZOMGit options
|
13
|
+
#
|
14
|
+
local opt_filter
|
15
|
+
opt_filter=()
|
16
|
+
|
17
|
+
zparseopts -K -D f:=opt_filter -filter:=opt_filter
|
18
|
+
|
19
|
+
if (( ${#gitopts[@]} > 0 )); then
|
20
|
+
command git status ${gitopts[@]}
|
21
|
+
else
|
22
|
+
local filter=""
|
23
|
+
|
24
|
+
if (( ${#opt_filter[@]} > 0 )); then
|
25
|
+
filter="--filter ${opt_filter[${#opt_filter[@]}]}"
|
26
|
+
fi
|
27
|
+
|
28
|
+
zomgit status ${filter}
|
29
|
+
fi
|
30
|
+
}
|
data/share/zomgit.zsh
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env zsh
|
2
|
+
|
3
|
+
_zomgit_dir=$(dirname $(realpath $0))
|
4
|
+
|
5
|
+
# Default ZOMGit dir
|
6
|
+
export ZOMGIT_DIR=$HOME/.zomgit
|
7
|
+
|
8
|
+
# Default config
|
9
|
+
export ZOMGIT_STATUS_MAX_CHANGES=150
|
10
|
+
|
11
|
+
# Source all command files
|
12
|
+
for f in $_zomgit_dir/commands/*.zsh; do
|
13
|
+
source $f
|
14
|
+
done
|
data/zomgit.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path(File.join("lib","zomgit","version.rb"))
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = "zomgit"
|
4
|
+
s.version = Zomgit::VERSION
|
5
|
+
s.author = "Robert Audi"
|
6
|
+
s.email = "robert@audii.me"
|
7
|
+
s.homepage = "https://github.com/RobertAudi/zomgit"
|
8
|
+
s.summary = "A git wrapper for the Z shell"
|
9
|
+
s.description = "A git wrapper for the Z shell (inspired by scm_breeze)"
|
10
|
+
s.license = "MIT"
|
11
|
+
s.files = `git ls-files -z`.split("\x0")
|
12
|
+
|
13
|
+
s.require_paths << "lib"
|
14
|
+
s.bindir = "bin"
|
15
|
+
s.executables << "zomgit"
|
16
|
+
|
17
|
+
s.add_development_dependency "rake", "~>10.0"
|
18
|
+
s.add_development_dependency "bundler", "~> 1.6"
|
19
|
+
|
20
|
+
s.add_runtime_dependency "gli", "2.11.0"
|
21
|
+
s.add_runtime_dependency "rainbow", "2.0.0"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zomgit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert Audi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gli
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.11.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.11.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rainbow
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.0
|
69
|
+
description: A git wrapper for the Z shell (inspired by scm_breeze)
|
70
|
+
email: robert@audii.me
|
71
|
+
executables:
|
72
|
+
- zomgit
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- bin/zomgit
|
82
|
+
- lib/zomgit.rb
|
83
|
+
- lib/zomgit/commands.rb
|
84
|
+
- lib/zomgit/commands/find.rb
|
85
|
+
- lib/zomgit/commands/status.rb
|
86
|
+
- lib/zomgit/concerns/findable.rb
|
87
|
+
- lib/zomgit/exceptions.rb
|
88
|
+
- lib/zomgit/helpers/file_helper.rb
|
89
|
+
- lib/zomgit/helpers/rainbow_helper.rb
|
90
|
+
- lib/zomgit/persistor.rb
|
91
|
+
- lib/zomgit/version.rb
|
92
|
+
- share/commands/add.zsh
|
93
|
+
- share/commands/branch.zsh
|
94
|
+
- share/commands/checkout.zsh
|
95
|
+
- share/commands/clone.zsh
|
96
|
+
- share/commands/commit.zsh
|
97
|
+
- share/commands/diff.zsh
|
98
|
+
- share/commands/log.zsh
|
99
|
+
- share/commands/push.zsh
|
100
|
+
- share/commands/reset.zsh
|
101
|
+
- share/commands/status.zsh
|
102
|
+
- share/zomgit.zsh
|
103
|
+
- zomgit.gemspec
|
104
|
+
homepage: https://github.com/RobertAudi/zomgit
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.2.2
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: A git wrapper for the Z shell
|
129
|
+
test_files: []
|