stash_cli 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db4f5c5620c404a3601a7fc23fb3ee0ec9f12c3c
4
- data.tar.gz: 3bcaa008262b447e0bf50f08088e7f46424b4b78
3
+ metadata.gz: 931c61d232560cf1f0856f572593ca263678ca6b
4
+ data.tar.gz: 893734422c626f819e62a439dc5fcfd7979e3bee
5
5
  SHA512:
6
- metadata.gz: 32ae74e1f9590b19d0248c806de849f80b3a6f3d92d94d58392b0428c902726ebdaef54d288902a4b287f5a09efd70d6db8b38289419edd1f1f6e1937e3cfc69
7
- data.tar.gz: 17e7f79f159b3fa171d1a365f0581ce8ae0c62b5555c57ed77b2281357d02256065f72bda6852a8df3df9339cb4ec7c1d9822286e36cf82e35d366ab7e7ae4e5
6
+ metadata.gz: f9cc90eacaefb56234afac09cf317317987a33924bcf8568ca6b8f61c07508cc8f0418a2cda06890eb5ee15cd5258ad6656684007ddac1b009cacbf0375754e5
7
+ data.tar.gz: 726a4ef25274d611fbae04b0fb9077b434296b470c47933e4a47f2c561aa9c2138361971bf254b6b88b1e1c286b19ca34cdc24722e7e6ece0e7769842423747b
data/lib/stash_cli/cli.rb CHANGED
@@ -91,6 +91,11 @@ module StashCLI
91
91
  type: :string,
92
92
  desc: 'the description'
93
93
 
94
+ option :long_description,
95
+ aliases: '-D',
96
+ type: :boolean,
97
+ desc: 'Write description in $EDITOR'
98
+
94
99
  option :open,
95
100
  type: :boolean,
96
101
  default: true,
@@ -149,6 +154,37 @@ module StashCLI
149
154
 
150
155
  protected
151
156
 
157
+ def get_description
158
+ if options[:long_description]
159
+ if options[:interactive]
160
+ say 'getting description via editor'
161
+ end
162
+
163
+ tmpfile = File.join('/tmp', "pull_request_desc_#{Time.now.to_i}")
164
+ system(ENV['EDITOR'], tmpfile)
165
+
166
+ if File.exists?(tmpfile)
167
+ contents = File.read(tmpfile)
168
+ File.delete(tmpfile)
169
+ return contents
170
+ else
171
+ say 'Aborting due to empty description'
172
+ exit 1
173
+ end
174
+ elsif options[:interactive]
175
+ description = ask("description [#{options[:description]}]:").strip
176
+ if description.empty?
177
+ return nil
178
+ end
179
+
180
+ return description
181
+ end
182
+
183
+
184
+ return options[:description] if options[:description]
185
+ nil
186
+ end
187
+
152
188
  def initial_reviewers
153
189
  users = options[:reviewers]
154
190
 
@@ -196,19 +232,20 @@ module StashCLI
196
232
  reviewers: reviewers
197
233
  }
198
234
 
199
- opts[:description] = options[:description] if options[:description]
235
+ description = get_description
236
+ opts[:description] = description if description
200
237
 
201
238
  opts
202
239
  end
203
240
 
204
241
  def interactive_pr(title)
242
+ description = get_description
243
+
205
244
  target_branch =
206
245
  ask("target branch [#{configatron.defaults.target_branch}]:").strip
207
246
 
208
247
  target_branch = configatron.defaults.target_branch if target_branch.empty?
209
248
 
210
- description = ask("description [#{options[:description]}]:").strip
211
-
212
249
  reviewers = initial_reviewers
213
250
 
214
251
  if yes?("use custom reviewers? [y/yes/n/no empty is no]:")
@@ -232,7 +269,7 @@ module StashCLI
232
269
  reviewers: reviewers
233
270
  }
234
271
 
235
- opts[:description] = description unless description.empty?
272
+ opts[:description] = description if description
236
273
 
237
274
  opts
238
275
  end
@@ -1,3 +1,3 @@
1
1
  module StashCli
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Chun-Lum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configatron