universa 3.10.5.1 → 3.10.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd3630d6a6c8fff3148c0f24f1105aaff2647dcf08209eb4cf70dac19f0eca56
4
- data.tar.gz: 91cde45beb3d577ee43cfc8e6f55c73fc106b10ba6c6c38228a6bd18daeb2893
3
+ metadata.gz: bca9c1f302fe4ede2b618ce1c3f4aab1b0333753f85c1ec517fb356ef89d5192
4
+ data.tar.gz: a9e46778d71229fb9e70346facf95b449de040718619b10c9d10f823accc0ac7
5
5
  SHA512:
6
- metadata.gz: ec691554decb811f2d3bb7bf26ccd78f25c97acf35444b02467502c2465c75e1f3ec295a59b496ca7b4472042c26c0a985a40645107612d756586c298dfe1ad1
7
- data.tar.gz: f6ba4803339e88a14a30c81c3445e3e9dba4e8fa627872af1bda0656f92e205553b6589b38b5a038a970d737f51511134db15dfbdf326e71ac96faec1c99484d
6
+ metadata.gz: 112e18a1eacd324186e2d57266d018da82fa95b64c9f67ccbdee98d873db2ba12196ab9f49e98998edbd3c410349e7330bd0261f7172b82e23d3a80622979c18
7
+ data.tar.gz: af99d73ab560a95b90b64e9c88a71db0ddcf262865320f287731abf7faa54060191172000145e733d93972a06a8bc8bdccb8bdd1835583db3ccae04efb98eea9
@@ -71,8 +71,12 @@ class KeyTool
71
71
  end
72
72
  end
73
73
 
74
- def output_file(extension = nil)
75
- name = @output_file or error "specify ouput file with -o / --output"
74
+ def output_file(extension = nil, overwrite_existing_name = nil)
75
+ name = @output_file
76
+ if !name
77
+ (overwrite_existing_name && @overwrite) or error "specify output file with -o / --output"
78
+ name = overwrite_existing_name
79
+ end
76
80
  extension && !name.end_with?(extension) ? "#{name}#{extension}" : name
77
81
  end
78
82
 
@@ -166,9 +170,10 @@ class KeyTool
166
170
  }
167
171
  }
168
172
 
169
- opts.on("-u FILE", "--update FILE", "update password on the existing key (also add/remove") { |name|
173
+ opts.on("-u FILE", "--update FILE", "update password on the existing key (also add/remove",
174
+ "requires -o output_file or --overwrite to change it in place") { |name|
170
175
  task {
171
- output = output_file(".private.unikey")
176
+ output = output_file(".private.unikey", name)
172
177
  check_overwrite output
173
178
  key = load_key(name)
174
179
  puts("\rKey loaded OK ")
@@ -194,8 +199,36 @@ class KeyTool
194
199
 
195
200
  opts.separator ""
196
201
 
202
+ def sample(text)
203
+ " " + ANSI.bold { ANSI.green { text } }
204
+ end
205
+
197
206
  opts.on_tail("-h", "--help", "Show this message") do
198
207
  puts opts
208
+ puts <<-End
209
+
210
+ #{ANSI.bold { "Usage samples:" }}
211
+
212
+ Generate new key 'foo.private.unikey' - will ask password from console (notice extension will be added automatically)
213
+
214
+ #{sample "unikeys -g 2048 -o foo"}
215
+
216
+ Show foo addresses:
217
+
218
+ #{sample "unikeys -s foo.private.unikey"}
219
+
220
+ Change password of the foo key and save it into new file bar.private.unikey (keeping both for security), will ask
221
+ new password from console
222
+
223
+ #{sample "unikeys -u foo.private.unikey -o bar"}
224
+
225
+ Change password in place (overwriting old file)
226
+
227
+ #{sample "unikeys -u foo.private.unikey -f"}
228
+
229
+ See project home page at #{ANSI.underline { "https://github.com/sergeych/universa" }}
230
+
231
+ End
199
232
  exit
200
233
  end
201
234
 
@@ -211,7 +244,11 @@ class KeyTool
211
244
  ## D_TIsYOfFQ2WejhG3
212
245
  begin
213
246
  opt_parser.order!
214
- @tasks.each { |t| t.call }
247
+ if @tasks.empty?
248
+ puts "nothing to do. Please specify one of: -g, -s or -u. See help for more (-h)."
249
+ else
250
+ @tasks.each { |t| t.call }
251
+ end
215
252
  rescue MessageException, OptionParser::ParseError => e
216
253
  STDERR.puts ANSI.red { ANSI.bold { "\nError: #{e}\n" } }
217
254
  exit(1000)
@@ -1,4 +1,4 @@
1
1
  module Universa
2
2
  # Current gem version
3
- VERSION = "3.10.5.1"
3
+ VERSION = "3.10.5.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universa
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.5.1
4
+ version: 3.10.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-11 00:00:00.000000000 Z
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: farcall