1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-03-19 21:04:35 +00:00

fix bug import preview

This commit is contained in:
nishiki 2013-08-31 22:14:51 +02:00
parent c412aae362
commit 906a7d4b4b
2 changed files with 5 additions and 5 deletions

5
Cli.rb
View file

@ -186,10 +186,9 @@ class Cli
if not force
if result.is_a?(Array) && !result.empty?
i = 0
result.each do |r|
puts "# --------------------"
puts "# Id: #{i}"
puts "# Id: #{r[MPW::ID]}"
puts "# Name: #{r[MPW::NAME]}"
puts "# Group: #{r[MPW::GROUP]}"
puts "# Server: #{r[MPW::SERVER]}"
@ -198,8 +197,6 @@ class Cli
puts "# Password: #{r[MPW::PASSWORD]}"
puts "# Port: #{r[MPW::PORT]}"
puts "# Comment: #{r[MPW::COMMENT]}"
i += 1
end
confirm = ask("Are you sure to import this file: #{file} ? (y/N) ")

5
MPW.rb
View file

@ -336,6 +336,7 @@ class MPW
def importPreview(file)
begin
result = Array.new()
id = 0
data = IO.read(file)
data.lines do |line|
@ -343,8 +344,10 @@ class MPW
@error_msg = "Can't import, the file is bad format!"
return false
else
result.push(line.parse_csv)
result.push(line.parse_csv.unshift(id))
end
id += 1
end
return result