mpw 4.2.1 → 4.2.2

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: 7bb595c7923b05fc36c530b58f5a8f31405e0a76
4
- data.tar.gz: c600a418220b168995b0e5a9d3ac31da98c40635
3
+ metadata.gz: bd7cabb7232c353bce58aa23e034f4475d4c784e
4
+ data.tar.gz: abcae3e4e64eed61a021dbfbaedcf220b06942ce
5
5
  SHA512:
6
- metadata.gz: d5287a720386e8f24e108680e8b65d7cdaabc39e5d8696c469e693b9921977123456c9499c625cb01edcef1b1bc1f6a996b90ad8848db1fe5affbee0934fd759
7
- data.tar.gz: 38c3df720e08f950318ff232fd5fa7e64e7cf77e0e852a73a8ce247dd76cb103f1131f5bc208d8937e3c5e9456befae6ce84478651b58addaa401f49fe1dc91b
6
+ metadata.gz: 00f35bb2da6bf78f3140b0697eac7caa07c387310dec5ab101e21551413b82182701667057e25a4d7648f55232d229a677e797966a3db0fa2780caeb84d6ecb5
7
+ data.tar.gz: f0e3c8b3e3b7338bb93e994376ac0e606f708a6700475dbf30a65f176abe0f0aebf59f07c63253c5162365590110536aa86854ff7fb495befa3cf2201ef536f2
@@ -1,4 +1,8 @@
1
1
  # CHANGELOG
2
+ ## v4.2.2 (2017-08-15)
3
+
4
+ * minor improvements in the interface
5
+
2
6
  ## v4.2.1 (2017-07-30)
3
7
 
4
8
  * fix bug in otp generator
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # MPW: Manage your passwords!
2
- [![Version](https://img.shields.io/badge/latest_version-4.2.1-green.svg)](https://github.com/nishiki/manage-password/releases)
2
+ [![Version](https://img.shields.io/badge/latest_version-4.2.2-green.svg)](https://github.com/nishiki/manage-password/releases)
3
3
  [![Build Status](https://travis-ci.org/nishiki/manage-password.svg?branch=master)](https://travis-ci.org/nishiki/manage-password)
4
4
  [![License](https://img.shields.io/badge/license-GPL--2.0-blue.svg)](https://github.com/nishiki/manage-password/blob/master/LICENSE)
5
5
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.2.1
1
+ 4.2.2
@@ -91,7 +91,9 @@ en:
91
91
  wallet_dir: "Set the wallets folder"
92
92
 
93
93
  form:
94
- select: "Select the item: "
94
+ select:
95
+ choice: "Select the item: "
96
+ error: "No item selected"
95
97
  add_key:
96
98
  valid: "Key has been added!"
97
99
  add_item:
@@ -91,7 +91,9 @@ fr:
91
91
  wallet_dir: "Spécifie le répertoire des portefeuilles"
92
92
 
93
93
  form:
94
- select: "Sélectionner l'élément: "
94
+ select:
95
+ choice: "Sélectionner l'élément: "
96
+ error: "Aucun élément sélectionné"
95
97
  add_key:
96
98
  valid: "La clé a bien été ajoutée!"
97
99
  add_item:
@@ -286,9 +286,22 @@ module MPW
286
286
  return items[0] if items.length == 1
287
287
 
288
288
  items.sort! { |a, b| a.group.to_s.downcase <=> b.group.to_s.downcase }
289
- choice = ask(I18n.t('form.select')).to_i
289
+ choice = ask(I18n.t('form.select.choice')).to_i
290
290
 
291
- choice >= 1 && choice <= items.length ? items[choice - 1] : nil
291
+ raise I18n.t('form.select.error') unless choice >= 1 && choice <= items.length
292
+
293
+ items[choice - 1]
294
+ end
295
+
296
+ # Print help message for clipboard mode
297
+ # @param item [Item]
298
+ def clipboard_help(item)
299
+ puts "----- #{I18n.t('form.clipboard.help.name')} -----".cyan
300
+ puts I18n.t('form.clipboard.help.url')
301
+ puts I18n.t('form.clipboard.help.login')
302
+ puts I18n.t('form.clipboard.help.password')
303
+ puts I18n.t('form.clipboard.help.otp_code') if item.otp
304
+ puts I18n.t('form.clipboard.help.quit')
292
305
  end
293
306
 
294
307
  # Copy in clipboard the login and password
@@ -339,7 +352,10 @@ module MPW
339
352
  end
340
353
 
341
354
  when 'o', 'otp'
342
- if clipboard
355
+ if !item.otp
356
+ clipboard_help(item)
357
+ next
358
+ elsif clipboard
343
359
  Clipboard.copy(@mpw.get_otp_code(item.id))
344
360
  else
345
361
  puts @mpw.get_otp_code(item.id)
@@ -347,13 +363,7 @@ module MPW
347
363
  puts I18n.t('form.clipboard.otp', time: @mpw.get_otp_remaining_time).yellow
348
364
 
349
365
  else
350
- puts "----- #{I18n.t('form.clipboard.help.name')} -----".cyan
351
- puts I18n.t('form.clipboard.help.url')
352
- puts I18n.t('form.clipboard.help.login')
353
- puts I18n.t('form.clipboard.help.password')
354
- puts I18n.t('form.clipboard.help.otp_code')
355
- puts I18n.t('form.clipboard.help.quit')
356
- next
366
+ clipboard_help(item)
357
367
  end
358
368
  end
359
369
 
@@ -161,6 +161,7 @@ module MPW
161
161
  # @param wallet [String] wallet name
162
162
  def set_wallet_path(path, wallet)
163
163
  path = @wallet_dir if path == 'default'
164
+ path = File.absolute_path(path)
164
165
 
165
166
  return if path == @wallet_dir && File.exist?("#{@wallet_dir}/#{wallet}.mpw")
166
167
  return if path == @wallet_paths[wallet]
@@ -1,9 +1,17 @@
1
1
  ---
2
- host: <%= options[:host] %> # <%= I18n.t('form.add_item.host') %>
3
- user: <%= options[:user] %> # <%= I18n.t('form.add_item.login') %>
4
- group: <%= options[:group] %> # <%= I18n.t('form.add_item.group') %>
5
- protocol: <%= options[:protocol] %> # <%= I18n.t('form.add_item.protocol') %><% unless password %>
6
- password: # <%= I18n.t('form.add_item.password') %><% end %>
7
- port: <%= options[:port] %> # <%= I18n.t('form.add_item.port') %>
8
- comment: <%= options[:comment] %> # <%= I18n.t('form.add_item.comment') %>
9
- otp_key: <%= options[:otp] %> # <%= I18n.t('form.add_item.otp_key') %>
2
+ # <%= I18n.t('form.add_item.host') %>
3
+ host: <%= options[:host] %>
4
+ # <%= I18n.t('form.add_item.login') %>
5
+ user: <%= options[:user] %>
6
+ # <%= I18n.t('form.add_item.group') %>
7
+ group: <%= options[:group] %>
8
+ # <%= I18n.t('form.add_item.protocol') %>
9
+ protocol: <%= options[:protocol] %><% unless password %>
10
+ # <%= I18n.t('form.add_item.password') %>
11
+ password:<% end %>
12
+ # <%= I18n.t('form.add_item.port') %>
13
+ port: <%= options[:port] %>
14
+ # <%= I18n.t('form.add_item.comment') %>
15
+ comment: <%= options[:comment] %>
16
+ # <%= I18n.t('form.add_item.otp_key') %>
17
+ otp_key: <%= options[:otp] %>
@@ -142,7 +142,6 @@ class TestConfig < Test::Unit::TestCase
142
142
  end
143
143
 
144
144
  def test_07_setup_wallet
145
- path = '/tmp/'
146
145
  gpg_key = 'test2@example.com'
147
146
 
148
147
  output = %x(echo #{@password} | mpw wallet --add-gpg-key #{gpg_key})
@@ -167,14 +166,14 @@ class TestConfig < Test::Unit::TestCase
167
166
  puts output
168
167
  assert_match('| default', output)
169
168
 
170
- output = %x(mpw wallet --path #{path})
169
+ output = %x(mpw wallet --path '.')
171
170
  puts output
172
171
  assert_match(I18n.t('form.set_wallet_path.valid'), output)
173
172
 
174
173
  output = %x(mpw config)
175
174
  puts output
176
- assert_match(%r{path_wallet_default.+\| #{path}/default.mpw}, output)
177
- assert(File.exist?("#{path}/default.mpw"))
175
+ assert_match(%r{path_wallet_default.+\| #{Dir.pwd}/default.mpw}, output)
176
+ assert(File.exist?("#{Dir.pwd}/default.mpw"))
178
177
 
179
178
  output = %x(mpw wallet --default-path)
180
179
  puts output
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpw
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Waksberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-30 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n