git_pr 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/git-pr +33 -1
  3. data/lib/git_pr/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7968f62060b92b884f997995272104332c1030e7
4
- data.tar.gz: 71f6a543bb64d27d0f938a695997ee3492d91629
3
+ metadata.gz: f8cc6ae5ee1b8542c6604e93b867b02f2ad50b3b
4
+ data.tar.gz: 2c5cba47012e107e6abcfded23dfeaf2854b7d75
5
5
  SHA512:
6
- metadata.gz: f820bb0fe822c56a9ee7c4545ec48c0e35639830f1e50d7d50a7ea3554a878611490c74f2fc491d176f8abec409207c5659a2eb822ba3e4468b62586ca408dbf
7
- data.tar.gz: f87879e59f11b490d89c360589ec0fb47f096b48003137593441be80bf4fb4c3be1f8e4da3af33b5727b99c3e1c4cf114c21c64d203ff2a4d0ac33b8f0ca46ba
6
+ metadata.gz: 932da4da4bdc06625caa8a4db56343a703e0e06bb4418e6643d08b2acb1a28e7b8426ad9ef839d500eb239ae8bd8ba0b43b501762672fb709eade05d91ab89e9
7
+ data.tar.gz: f4cdb8e73c7e3eae5375186f9f4eefd1df25ed02c31e3213456df13577b956e41f3c8cab376dd80e8408ac2c1c2bf3b681b839301f6730fb3eab3e93b73587c5
data/bin/git-pr CHANGED
@@ -125,6 +125,24 @@ eos
125
125
  end
126
126
  }
127
127
 
128
+ def alias_to_subcommand(subcommand)
129
+ case subcommand
130
+ when "dt", /^difft/
131
+ "difftool"
132
+ when "d", /^d/
133
+ "diff"
134
+ when "web", /^o/
135
+ "open"
136
+ when "ls", /^l/
137
+ "list"
138
+ when "ci", /^m/
139
+ "merge"
140
+ else
141
+ subcommand
142
+ end
143
+ end
144
+
145
+ # Parse global options. Print help if any unrecognized
128
146
  begin
129
147
  global_options.order!
130
148
  rescue OptionParser::InvalidOption => e
@@ -133,12 +151,26 @@ rescue OptionParser::InvalidOption => e
133
151
  exit
134
152
  end
135
153
 
136
- command = ARGV.shift
154
+ command = alias_to_subcommand(ARGV.shift)
155
+
156
+ # Check for the special command help. Support "git pr help" and "git pr help <subcommand>"
157
+ if command == "help"
158
+ command = alias_to_subcommand(ARGV.shift)
159
+ if subcommands[command]
160
+ puts subcommands[command]
161
+ else
162
+ puts global_options
163
+ end
164
+ exit
165
+ end
166
+
167
+ # Unrecognized command? Print help and exit
137
168
  if !subcommands[command]
138
169
  puts global_options
139
170
  exit
140
171
  end
141
172
 
173
+ # Parse subcommand options. Print help if any unrecognized
142
174
  begin
143
175
  options[command].additional_arguments = subcommands[command].permute!
144
176
  rescue OptionParser::InvalidOption => e
@@ -1,3 +1,3 @@
1
1
  module GitPr
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Sharon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize