mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-22 02:40:04 +00:00
fix indentation for multiline method and hash
This commit is contained in:
parent
782f3d8b5f
commit
b1fd013d92
3 changed files with 45 additions and 43 deletions
|
@ -148,8 +148,7 @@ class MPW::Cli
|
||||||
protocol: { length: 9, color: 'white' },
|
protocol: { length: 9, color: 'white' },
|
||||||
port: { length: 5, color: 'white' },
|
port: { length: 5, color: 'white' },
|
||||||
otp: { length: 4, color: 'white' },
|
otp: { length: 4, color: 'white' },
|
||||||
comment: { length: 14, color: 'magenta' },
|
comment: { length: 14, color: 'magenta' } }
|
||||||
}
|
|
||||||
|
|
||||||
items.each do |item|
|
items.each do |item|
|
||||||
data.each do |k, v|
|
data.each do |k, v|
|
||||||
|
@ -481,18 +480,20 @@ class MPW::Cli
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
items.each do |item|
|
items.each do |item|
|
||||||
data.merge!(item.id => { 'host' => item.host,
|
data.merge!(
|
||||||
'user' => item.user,
|
item.id => {
|
||||||
'group' => item.group,
|
'host' => item.host,
|
||||||
'password' => @mpw.get_password(item.id),
|
'user' => item.user,
|
||||||
'protocol' => item.protocol,
|
'group' => item.group,
|
||||||
'port' => item.port,
|
'password' => @mpw.get_password(item.id),
|
||||||
'otp_key' => @mpw.get_otp_key(item.id),
|
'protocol' => item.protocol,
|
||||||
'comment' => item.comment,
|
'port' => item.port,
|
||||||
'last_edit' => item.last_edit,
|
'otp_key' => @mpw.get_otp_key(item.id),
|
||||||
'created' => item.created,
|
'comment' => item.comment,
|
||||||
}
|
'last_edit' => item.last_edit,
|
||||||
)
|
'created' => item.created,
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(file, 'w') { |f| f << data.to_yaml }
|
File.open(file, 'w') { |f| f << data.to_yaml }
|
||||||
|
@ -514,8 +515,7 @@ class MPW::Cli
|
||||||
protocol: row['protocol'],
|
protocol: row['protocol'],
|
||||||
user: row['user'],
|
user: row['user'],
|
||||||
port: row['port'],
|
port: row['port'],
|
||||||
comment: row['comment'],
|
comment: row['comment'])
|
||||||
)
|
|
||||||
|
|
||||||
next if item.empty?
|
next if item.empty?
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,7 @@ class MPW::Config
|
||||||
password = { numeric: true,
|
password = { numeric: true,
|
||||||
alpha: true,
|
alpha: true,
|
||||||
special: false,
|
special: false,
|
||||||
length: 16,
|
length: 16 }
|
||||||
}
|
|
||||||
|
|
||||||
%w(numeric special alpha length).each do |k|
|
%w(numeric special alpha length).each do |k|
|
||||||
if options.key?("pwd_#{k}".to_sym)
|
if options.key?("pwd_#{k}".to_sym)
|
||||||
|
@ -81,8 +80,7 @@ class MPW::Config
|
||||||
'wallet_dir' => wallet_dir,
|
'wallet_dir' => wallet_dir,
|
||||||
'default_wallet' => default_wallet,
|
'default_wallet' => default_wallet,
|
||||||
'gpg_exe' => gpg_exe,
|
'gpg_exe' => gpg_exe,
|
||||||
'password' => password,
|
'password' => password }
|
||||||
}
|
|
||||||
|
|
||||||
FileUtils.mkdir_p(@config_dir, mode: 0700)
|
FileUtils.mkdir_p(@config_dir, mode: 0700)
|
||||||
FileUtils.mkdir_p(wallet_dir, mode: 0700)
|
FileUtils.mkdir_p(wallet_dir, mode: 0700)
|
||||||
|
|
|
@ -80,18 +80,20 @@ class MPW::MPW
|
||||||
|
|
||||||
unless data.to_s.empty?
|
unless data.to_s.empty?
|
||||||
YAML.safe_load(data).each_value do |d|
|
YAML.safe_load(data).each_value do |d|
|
||||||
@data.push(Item.new(id: d['id'],
|
@data.push(
|
||||||
group: d['group'],
|
Item.new(
|
||||||
host: d['host'],
|
id: d['id'],
|
||||||
protocol: d['protocol'],
|
group: d['group'],
|
||||||
user: d['user'],
|
host: d['host'],
|
||||||
port: d['port'],
|
protocol: d['protocol'],
|
||||||
otp: @otp_keys.key?(d['id']),
|
user: d['user'],
|
||||||
comment: d['comment'],
|
port: d['port'],
|
||||||
last_edit: d['last_edit'],
|
otp: @otp_keys.key?(d['id']),
|
||||||
created: d['created'],
|
comment: d['comment'],
|
||||||
)
|
last_edit: d['last_edit'],
|
||||||
)
|
created: d['created'],
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -108,17 +110,19 @@ class MPW::MPW
|
||||||
@data.each do |item|
|
@data.each do |item|
|
||||||
next if item.empty?
|
next if item.empty?
|
||||||
|
|
||||||
data.merge!(item.id => { 'id' => item.id,
|
data.merge!(
|
||||||
'group' => item.group,
|
item.id => {
|
||||||
'host' => item.host,
|
'id' => item.id,
|
||||||
'protocol' => item.protocol,
|
'group' => item.group,
|
||||||
'user' => item.user,
|
'host' => item.host,
|
||||||
'port' => item.port,
|
'protocol' => item.protocol,
|
||||||
'comment' => item.comment,
|
'user' => item.user,
|
||||||
'last_edit' => item.last_edit,
|
'port' => item.port,
|
||||||
'created' => item.created,
|
'comment' => item.comment,
|
||||||
}
|
'last_edit' => item.last_edit,
|
||||||
)
|
'created' => item.created,
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@config['last_update'] = Time.now.to_i
|
@config['last_update'] = Time.now.to_i
|
||||||
|
|
Loading…
Add table
Reference in a new issue