mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-20 01:50: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' },
|
||||
port: { length: 5, color: 'white' },
|
||||
otp: { length: 4, color: 'white' },
|
||||
comment: { length: 14, color: 'magenta' },
|
||||
}
|
||||
comment: { length: 14, color: 'magenta' } }
|
||||
|
||||
items.each do |item|
|
||||
data.each do |k, v|
|
||||
|
@ -481,18 +480,20 @@ class MPW::Cli
|
|||
data = {}
|
||||
|
||||
items.each do |item|
|
||||
data.merge!(item.id => { 'host' => item.host,
|
||||
'user' => item.user,
|
||||
'group' => item.group,
|
||||
'password' => @mpw.get_password(item.id),
|
||||
'protocol' => item.protocol,
|
||||
'port' => item.port,
|
||||
'otp_key' => @mpw.get_otp_key(item.id),
|
||||
'comment' => item.comment,
|
||||
'last_edit' => item.last_edit,
|
||||
'created' => item.created,
|
||||
}
|
||||
)
|
||||
data.merge!(
|
||||
item.id => {
|
||||
'host' => item.host,
|
||||
'user' => item.user,
|
||||
'group' => item.group,
|
||||
'password' => @mpw.get_password(item.id),
|
||||
'protocol' => item.protocol,
|
||||
'port' => item.port,
|
||||
'otp_key' => @mpw.get_otp_key(item.id),
|
||||
'comment' => item.comment,
|
||||
'last_edit' => item.last_edit,
|
||||
'created' => item.created,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
File.open(file, 'w') { |f| f << data.to_yaml }
|
||||
|
@ -514,8 +515,7 @@ class MPW::Cli
|
|||
protocol: row['protocol'],
|
||||
user: row['user'],
|
||||
port: row['port'],
|
||||
comment: row['comment'],
|
||||
)
|
||||
comment: row['comment'])
|
||||
|
||||
next if item.empty?
|
||||
|
||||
|
|
|
@ -60,8 +60,7 @@ class MPW::Config
|
|||
password = { numeric: true,
|
||||
alpha: true,
|
||||
special: false,
|
||||
length: 16,
|
||||
}
|
||||
length: 16 }
|
||||
|
||||
%w(numeric special alpha length).each do |k|
|
||||
if options.key?("pwd_#{k}".to_sym)
|
||||
|
@ -81,8 +80,7 @@ class MPW::Config
|
|||
'wallet_dir' => wallet_dir,
|
||||
'default_wallet' => default_wallet,
|
||||
'gpg_exe' => gpg_exe,
|
||||
'password' => password,
|
||||
}
|
||||
'password' => password }
|
||||
|
||||
FileUtils.mkdir_p(@config_dir, mode: 0700)
|
||||
FileUtils.mkdir_p(wallet_dir, mode: 0700)
|
||||
|
|
|
@ -80,18 +80,20 @@ class MPW::MPW
|
|||
|
||||
unless data.to_s.empty?
|
||||
YAML.safe_load(data).each_value do |d|
|
||||
@data.push(Item.new(id: d['id'],
|
||||
group: d['group'],
|
||||
host: d['host'],
|
||||
protocol: d['protocol'],
|
||||
user: d['user'],
|
||||
port: d['port'],
|
||||
otp: @otp_keys.key?(d['id']),
|
||||
comment: d['comment'],
|
||||
last_edit: d['last_edit'],
|
||||
created: d['created'],
|
||||
)
|
||||
)
|
||||
@data.push(
|
||||
Item.new(
|
||||
id: d['id'],
|
||||
group: d['group'],
|
||||
host: d['host'],
|
||||
protocol: d['protocol'],
|
||||
user: d['user'],
|
||||
port: d['port'],
|
||||
otp: @otp_keys.key?(d['id']),
|
||||
comment: d['comment'],
|
||||
last_edit: d['last_edit'],
|
||||
created: d['created'],
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -108,17 +110,19 @@ class MPW::MPW
|
|||
@data.each do |item|
|
||||
next if item.empty?
|
||||
|
||||
data.merge!(item.id => { 'id' => item.id,
|
||||
'group' => item.group,
|
||||
'host' => item.host,
|
||||
'protocol' => item.protocol,
|
||||
'user' => item.user,
|
||||
'port' => item.port,
|
||||
'comment' => item.comment,
|
||||
'last_edit' => item.last_edit,
|
||||
'created' => item.created,
|
||||
}
|
||||
)
|
||||
data.merge!(
|
||||
item.id => {
|
||||
'id' => item.id,
|
||||
'group' => item.group,
|
||||
'host' => item.host,
|
||||
'protocol' => item.protocol,
|
||||
'user' => item.user,
|
||||
'port' => item.port,
|
||||
'comment' => item.comment,
|
||||
'last_edit' => item.last_edit,
|
||||
'created' => item.created,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
@config['last_update'] = Time.now.to_i
|
||||
|
|
Loading…
Add table
Reference in a new issue