mpw 4.0.0 → 4.1.0
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 +4 -4
- data/.rubocop.yml +122 -0
- data/.travis.yml +2 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +7 -9
- data/README.md +1 -7
- data/VERSION +1 -1
- data/bin/mpw +25 -25
- data/bin/mpw-add +54 -25
- data/bin/mpw-config +74 -62
- data/bin/mpw-copy +25 -30
- data/bin/mpw-delete +24 -29
- data/bin/mpw-export +27 -32
- data/bin/mpw-genpwd +22 -22
- data/bin/mpw-import +20 -25
- data/bin/mpw-list +24 -29
- data/bin/mpw-update +61 -32
- data/bin/mpw-wallet +48 -73
- data/i18n/en.yml +15 -26
- data/i18n/fr.yml +15 -26
- data/lib/mpw/cli.rb +554 -546
- data/lib/mpw/config.rb +168 -139
- data/lib/mpw/item.rb +75 -82
- data/lib/mpw/mpw.rb +328 -465
- data/mpw.gemspec +11 -10
- data/templates/add_form.erb +8 -8
- data/templates/update_form.erb +7 -7
- data/test/test_config.rb +70 -55
- data/test/test_item.rb +167 -167
- data/test/test_mpw.rb +132 -132
- data/test/test_translate.rb +23 -23
- data/test/tests.rb +1 -1
- metadata +4 -45
- data/lib/mpw/sync/ftp.rb +0 -68
- data/lib/mpw/sync/ssh.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81608d9969c62b9a2d545b091e85e11e036d0fb6
|
4
|
+
data.tar.gz: ca92f9c9b5626d72af12dc5aaa9914376acd790e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3c92de6bfbacbf52b143ce155795a544c987fc4ea683eb2dc43158f82035e6c33e2ae046dc90d3f12d1201c38c73298d94e71d01bbe96db7ebbf3bf37514864
|
7
|
+
data.tar.gz: '004278306d45d232007ff259a39b219899f1590c2000fccf864ea80d30dfaa060c6a36eeaab65348b212c766339acd61337d94bd9538c46318752e0e905e2e04'
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
|
2
|
+
AllCops:
|
3
|
+
Exclude:
|
4
|
+
- db/**/*
|
5
|
+
- config/**/*
|
6
|
+
- test/*
|
7
|
+
- Vagrantfile
|
8
|
+
TargetRubyVersion: 2.3
|
9
|
+
|
10
|
+
Style/AccessorMethodName:
|
11
|
+
Enabled: false
|
12
|
+
Style/NumericLiteralPrefix:
|
13
|
+
Enabled: false
|
14
|
+
Style/TrailingCommaInArguments:
|
15
|
+
Enabled: false
|
16
|
+
Style/TrailingCommaInLiteral:
|
17
|
+
Enabled: false
|
18
|
+
Style/FrozenStringLiteralComment:
|
19
|
+
Enabled: false
|
20
|
+
Metrics/ParameterLists:
|
21
|
+
Max: 5
|
22
|
+
CountKeywordArgs: false
|
23
|
+
Style/MutableConstant:
|
24
|
+
Enabled: false
|
25
|
+
Metrics/LineLength:
|
26
|
+
Max: 120
|
27
|
+
Metrics/AbcSize:
|
28
|
+
Enabled: false
|
29
|
+
Metrics/MethodLength:
|
30
|
+
Enabled: false
|
31
|
+
Metrics/BlockLength:
|
32
|
+
Enabled: false
|
33
|
+
Metrics/CyclomaticComplexity:
|
34
|
+
Enabled: false
|
35
|
+
Metrics/PerceivedComplexity:
|
36
|
+
Enabled: false
|
37
|
+
Metrics/ClassLength:
|
38
|
+
Enabled: false
|
39
|
+
Style/SpaceInsideHashLiteralBraces:
|
40
|
+
Enabled: false
|
41
|
+
Style/AsciiComments:
|
42
|
+
Enabled: true
|
43
|
+
Style/Documentation:
|
44
|
+
Enabled: false
|
45
|
+
Style/SignalException:
|
46
|
+
Enabled: false
|
47
|
+
Style/OptionHash:
|
48
|
+
Enabled: true
|
49
|
+
Style/SymbolArray:
|
50
|
+
Enabled: true
|
51
|
+
Performance/Casecmp:
|
52
|
+
Enabled: false
|
53
|
+
Style/DoubleNegation:
|
54
|
+
Enabled: false
|
55
|
+
Style/Alias:
|
56
|
+
EnforcedStyle: prefer_alias_method
|
57
|
+
Style/MultilineMethodCallIndentation:
|
58
|
+
EnforcedStyle: indented
|
59
|
+
Style/RaiseArgs:
|
60
|
+
EnforcedStyle: exploded
|
61
|
+
Style/SpaceInLambdaLiteral:
|
62
|
+
Enabled: false
|
63
|
+
Lint/UnneededSplatExpansion:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
|
67
|
+
# Generated configuration
|
68
|
+
Style/HashSyntax:
|
69
|
+
Enabled: true
|
70
|
+
EnforcedStyle: ruby19
|
71
|
+
UseHashRocketsWithSymbolValues: false
|
72
|
+
Style/MethodDefParentheses:
|
73
|
+
Enabled: true
|
74
|
+
EnforcedStyle: require_parentheses
|
75
|
+
Style/MultilineAssignmentLayout:
|
76
|
+
Enabled: true
|
77
|
+
EnforcedStyle: new_line
|
78
|
+
Style/IndentationConsistency:
|
79
|
+
Enabled: true
|
80
|
+
EnforcedStyle: normal
|
81
|
+
Style/AlignParameters:
|
82
|
+
Enabled: true
|
83
|
+
EnforcedStyle: with_fixed_indentation
|
84
|
+
Style/BlockDelimiters:
|
85
|
+
Enabled: true
|
86
|
+
EnforcedStyle: line_count_based
|
87
|
+
Style/AndOr:
|
88
|
+
Enabled: true
|
89
|
+
Style/DotPosition:
|
90
|
+
Enabled: true
|
91
|
+
EnforcedStyle: leading
|
92
|
+
Style/EmptyLinesAroundClassBody:
|
93
|
+
Enabled: true
|
94
|
+
EnforcedStyle: no_empty_lines
|
95
|
+
Style/EmptyLinesAroundModuleBody:
|
96
|
+
Enabled: true
|
97
|
+
EnforcedStyle: no_empty_lines
|
98
|
+
Style/NumericPredicate:
|
99
|
+
Enabled: true
|
100
|
+
EnforcedStyle: comparison
|
101
|
+
Style/EvenOdd:
|
102
|
+
Enabled: false
|
103
|
+
Style/CollectionMethods:
|
104
|
+
Enabled: true
|
105
|
+
PreferredMethods:
|
106
|
+
collect: map
|
107
|
+
collect!: map!
|
108
|
+
inject: reduce
|
109
|
+
detect: find
|
110
|
+
find_all: select
|
111
|
+
Style/EmptyLinesAroundAccessModifier:
|
112
|
+
Enabled: true
|
113
|
+
Style/CommandLiteral:
|
114
|
+
Enabled: true
|
115
|
+
EnforcedStyle: percent_x
|
116
|
+
Style/StringLiterals:
|
117
|
+
Enabled: true
|
118
|
+
EnforcedStyle: single_quotes
|
119
|
+
Style/SpaceInsideBlockBraces:
|
120
|
+
EnforcedStyle: space
|
121
|
+
Style/VariableNumber:
|
122
|
+
EnforcedStyle: snake_case
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
|
+
## v4.1.0
|
3
|
+
|
4
|
+
* feat: add options to update or add an item in command line
|
5
|
+
* feat: print config
|
6
|
+
* feat: add a specific path for a wallet
|
7
|
+
* feat: add rubocop to fix syntax
|
8
|
+
* fix: pinentry mode with gpg >= 2.1
|
9
|
+
* remove SSH and FTP synchronization
|
10
|
+
|
2
11
|
## v4.0.0
|
3
12
|
|
4
13
|
* feature: set default wallet
|
data/Gemfile
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
gem
|
3
|
-
gem
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem "clipboard", "~> 1.1", ">= 1.1.1"
|
10
|
-
gem "rotp", "~> 3.1", ">= 3.1.0"
|
2
|
+
gem 'clipboard', '~> 1.1', '>= 1.1.1'
|
3
|
+
gem 'colorize', '~> 0.8', '>= 0.8.1'
|
4
|
+
gem 'gpgme', '~> 2.0', '>= 2.0.12'
|
5
|
+
gem 'highline', '~> 1.7', '>= 1.7.8'
|
6
|
+
gem 'i18n', '~> 0.7', '>= 0.7.0'
|
7
|
+
gem 'locale', '~> 2.1', '>= 2.1.2'
|
8
|
+
gem 'rotp', '~> 3.1', '>= 3.1.0'
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# MPW: Manage your passwords!
|
2
|
-
[](https://github.com/nishiki/manage-password/releases)
|
3
3
|
[](https://travis-ci.org/nishiki/manage-password)
|
4
4
|
[](https://github.com/nishiki/manage-password/blob/master/LICENSE)
|
5
5
|
|
@@ -11,7 +11,6 @@ mpw is a little software which stores your passwords in [GnuPG](http://www.gnupg
|
|
11
11
|
* generate OTP code
|
12
12
|
* copy your login, password or otp in clipboard
|
13
13
|
* manage many wallets
|
14
|
-
* synchronize your passwords with SSH or FTP.
|
15
14
|
* share a wallet with others GPG keys
|
16
15
|
|
17
16
|
## Install
|
@@ -105,11 +104,6 @@ Remove a GPG key:
|
|
105
104
|
mpw wallet --delete-gpg-key test42@localhost.com
|
106
105
|
```
|
107
106
|
|
108
|
-
Add synchronize:
|
109
|
-
```
|
110
|
-
mpw wallet --protocol ssh --host example.com --user test --path /remote/path --password
|
111
|
-
```
|
112
|
-
|
113
107
|
### Export and import data
|
114
108
|
|
115
109
|
You can export your data in yaml file with your passwords in clear text:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.1.0
|
data/bin/mpw
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# MPW is a software to crypt and manage your passwords
|
3
|
-
# Copyright (C)
|
4
|
-
#
|
3
|
+
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
|
4
|
+
#
|
5
5
|
# This program is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU General Public License
|
7
7
|
# as published by the Free Software Foundation; either version 2
|
8
8
|
# of the License, or (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# This program is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU General Public License
|
16
16
|
# along with this program; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
18
18
|
|
19
|
-
|
19
|
+
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
|
20
20
|
|
21
21
|
require 'locale'
|
22
22
|
require 'set'
|
@@ -30,7 +30,7 @@ require 'colorize'
|
|
30
30
|
lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1]
|
31
31
|
|
32
32
|
if defined?(I18n.enforce_available_locales)
|
33
|
-
|
33
|
+
I18n.enforce_available_locales = true
|
34
34
|
end
|
35
35
|
|
36
36
|
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
@@ -45,25 +45,25 @@ I18n.locale = lang.to_sym
|
|
45
45
|
bin_dir = File.dirname(__FILE__)
|
46
46
|
command = "#{bin_dir}/mpw-#{ARGV[0]}"
|
47
47
|
|
48
|
-
if Dir.glob("#{bin_dir}/mpw-*").include?(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
if Dir.glob("#{bin_dir}/mpw-*").include?(command.to_s)
|
49
|
+
begin
|
50
|
+
Kernel.load(command)
|
51
|
+
rescue OptionParser::ParseError => e
|
52
|
+
puts "#{I18n.t('display.error')}: #{e}".red
|
53
|
+
end
|
54
54
|
else
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
55
|
+
puts "#{I18n.t('option.usage')}: mpw COMMAND [options]\n\n"
|
56
|
+
puts 'Commands:'
|
57
|
+
puts " add #{I18n.t('command.add')}"
|
58
|
+
puts " config #{I18n.t('command.config')}"
|
59
|
+
puts " copy #{I18n.t('command.copy')}"
|
60
|
+
puts " delete #{I18n.t('command.delete')}"
|
61
|
+
puts " export #{I18n.t('command.export')}"
|
62
|
+
puts " genpwd #{I18n.t('command.genpwd')}"
|
63
|
+
puts " import #{I18n.t('command.import')}"
|
64
|
+
puts " list #{I18n.t('command.list')}"
|
65
|
+
puts " update #{I18n.t('command.update')}"
|
66
|
+
puts " wallet #{I18n.t('command.wallet')}"
|
67
67
|
|
68
|
-
|
68
|
+
exit 3
|
69
69
|
end
|
data/bin/mpw-add
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# MPW is a software to crypt and manage your passwords
|
3
|
-
# Copyright (C)
|
4
|
-
#
|
3
|
+
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
|
4
|
+
#
|
5
5
|
# This program is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU General Public License
|
7
7
|
# as published by the Free Software Foundation; either version 2
|
8
8
|
# of the License, or (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# This program is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU General Public License
|
16
16
|
# along with this program; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
@@ -24,38 +24,67 @@ require 'mpw/cli'
|
|
24
24
|
# Options
|
25
25
|
# --------------------------------------------------------- #
|
26
26
|
|
27
|
-
|
28
|
-
options
|
27
|
+
values = {}
|
28
|
+
options = {}
|
29
|
+
options[:text_editor] = true
|
29
30
|
|
30
31
|
OptionParser.new do |opts|
|
31
|
-
|
32
|
+
opts.banner = "#{I18n.t('option.usage')}: mpw add [options]"
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
|
35
|
+
options[:config] = config
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
38
|
+
opts.on('-C', '--comment COMMENT', I18n.t('option.comment')) do |comment|
|
39
|
+
values[:comment] = comment
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
opts.on('-G', '--group NAME', I18n.t('option.new_group')) do |group|
|
43
|
+
values[:group] = group
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
opts.on('-h', '--help', I18n.t('option.help')) do
|
47
|
+
puts opts
|
48
|
+
exit 0
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
opts.on('-H', '--host HOST', I18n.t('option.host')) do |host|
|
52
|
+
values[:host] = host
|
53
|
+
end
|
54
|
+
|
55
|
+
opts.on('-o', '--otp-code CODE', I18n.t('option.otp_code')) do |otp|
|
56
|
+
values[:otp_key] = otp
|
57
|
+
end
|
58
|
+
|
59
|
+
opts.on('-O', '--protocol PROTOCOL', I18n.t('option.protocol')) do |protocol|
|
60
|
+
values[:protocol] = protocol
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.on('-P', '--port NUMBER', I18n.t('option.port')) do |port|
|
64
|
+
values[:port] = port
|
65
|
+
end
|
66
|
+
|
67
|
+
opts.on('-r', '--random', I18n.t('option.random_password')) do
|
68
|
+
options[:password] = true
|
69
|
+
end
|
70
|
+
|
71
|
+
opts.on('-t', '--text-editor', I18n.t('option.text_editor')) do
|
72
|
+
options[:text_editor] = true
|
73
|
+
end
|
74
|
+
|
75
|
+
opts.on('-u', '--user USER', I18n.t('option.user')) do |user|
|
76
|
+
values[:user] = user
|
77
|
+
end
|
78
|
+
|
79
|
+
opts.on('-w', '--wallet NAME', I18n.t('option.wallet')) do |wallet|
|
80
|
+
options[:wallet] = wallet
|
81
|
+
end
|
53
82
|
end.parse!
|
54
83
|
|
55
84
|
config = MPW::Config.new(options[:config])
|
56
|
-
cli = MPW::Cli.new(config
|
85
|
+
cli = MPW::Cli.new(config)
|
57
86
|
|
58
87
|
cli.load_config
|
59
88
|
cli.get_wallet(options[:wallet])
|
60
89
|
cli.decrypt
|
61
|
-
cli.add(options[:password])
|
90
|
+
cli.add(options[:password], options[:text_editor], values)
|
data/bin/mpw-config
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# MPW is a software to crypt and manage your passwords
|
3
|
-
# Copyright (C)
|
4
|
-
#
|
3
|
+
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
|
4
|
+
#
|
5
5
|
# This program is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU General Public License
|
7
7
|
# as published by the Free Software Foundation; either version 2
|
8
8
|
# of the License, or (at your option) any later version.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# This program is distributed in the hope that it will be useful,
|
11
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
13
|
# GNU General Public License for more details.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# You should have received a copy of the GNU General Public License
|
16
16
|
# along with this program; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
@@ -28,81 +28,93 @@ options = {}
|
|
28
28
|
values = {}
|
29
29
|
|
30
30
|
OptionParser.new do |opts|
|
31
|
-
|
31
|
+
opts.banner = "#{I18n.t('option.usage')}: mpw config [options]"
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
opts.on('-c', '--config PATH', I18n.t('option.config')) do |config|
|
34
|
+
options[:config] = config
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
opts.on('-d', '--default-wallet NAME', I18n.t('option.default_wallet')) do |default_wallet|
|
38
|
+
values[:default_wallet] = default_wallet
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
opts.on('-g', '--gpg-exe PATH', I18n.t('option.gpg_exe')) do |gpg_exe|
|
42
|
+
values[:gpg_exe] = gpg_exe
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
opts.on('-h', '--help', I18n.t('option.help')) do
|
46
|
+
puts opts
|
47
|
+
exit 0
|
48
|
+
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
opts.on('-i', '--init GPG_KEY', I18n.t('option.init')) do |gpg_key|
|
51
|
+
options[:init] = true
|
52
|
+
values[:gpg_key] = gpg_key
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
opts.on('-k', '--key GPG_KEY', I18n.t('option.gpg_key')) do |gpg_key|
|
56
|
+
values[:gpg_key] = gpg_key
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
opts.on('-L', '--lang LANG', I18n.t('option.lang')) do |lang|
|
60
|
+
values[:lang] = lang
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
opts.on('-P', '--enable-pinmode', I18n.t('option.pinmode')) do
|
64
|
+
values[:pinmode] = true
|
65
|
+
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
opts.on('-p', '--disable-pinmode', I18n.t('option.disable_pinmode')) do
|
68
|
+
values[:pinmode] = false
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
opts.on('-w', '--wallet-dir PATH', I18n.t('option.wallet_dir')) do |wallet_dir|
|
72
|
+
values[:wallet_dir] = wallet_dir
|
73
|
+
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
opts.on('-l', '--length NUMBER', I18n.t('option.length')) do |length|
|
76
|
+
values[:pwd_length] = length.to_i
|
77
|
+
end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
opts.on('-n', '--numeric', I18n.t('option.numeric')) do
|
80
|
+
values[:pwd_numeric] = true
|
81
|
+
end
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
opts.on('-N', '--disable-numeric', I18n.t('option.disable_numeric')) do
|
84
|
+
values[:pwd_numeric] = false
|
85
|
+
end
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
opts.on('-s', '--special-chars', I18n.t('option.special_chars')) do
|
88
|
+
values[:pwd_special] = true
|
89
|
+
end
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
opts.on('-S', '--disable_special-chars', I18n.t('option.special_chars')) do
|
92
|
+
values[:pwd_special] = false
|
93
|
+
end
|
94
|
+
|
95
|
+
opts.on('-a', '--alpha', I18n.t('option.alpha')) do
|
96
|
+
values[:pwd_alpha] = true
|
97
|
+
end
|
98
|
+
|
99
|
+
opts.on('-A', '--disable-alpha', I18n.t('option.disable_alpha')) do
|
100
|
+
values[:pwd_alpha] = false
|
101
|
+
end
|
94
102
|
end.parse!
|
95
103
|
|
96
104
|
config = MPW::Config.new(options[:config])
|
97
|
-
cli = MPW::Cli.new(config
|
98
|
-
|
99
|
-
if options.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
+
cli = MPW::Cli.new(config)
|
106
|
+
|
107
|
+
if options.key?(:init)
|
108
|
+
cli.setup(values)
|
109
|
+
cli.load_config
|
110
|
+
cli.get_wallet
|
111
|
+
cli.setup_gpg_key(values[:gpg_key])
|
112
|
+
cli.setup_wallet_config
|
105
113
|
else
|
106
|
-
|
107
|
-
|
114
|
+
cli.load_config
|
115
|
+
if values.empty?
|
116
|
+
cli.list_config
|
117
|
+
else
|
118
|
+
cli.set_config(values)
|
119
|
+
end
|
108
120
|
end
|