Method: Keybox::Application::PasswordSafe#show

Defined in:
lib/keybox/application/password_safe.rb

#show(account) ⇒ Object

output all the information for the accounts matching



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/keybox/application/password_safe.rb', line 381

def show()
    matches = @db.find()
    if matches.size > 0 then
        matches.each_with_index do |match,i|
            hsay "#{sprintf("%3d",i + 1)}. #{match.title}", :header
            max_name_length = match.max_field_length + 1
            match.each do |name,value|
                next if name == "title"
                next if value.length == 0

                name_out = name.rjust(max_name_length)
                @highline.say("<%= color(%Q{#{name_out}}, :name) %> <%= color(':',:separator) %> ")

                if match.private_field?(name) then
                    @highline.ask(
                       "<%= color(%Q{#{value}},:private) %> <%= color('(press any key).', :prompt) %> "
                    ) do |q|
                        q.overwrite = true
                        q.echo      = false
                        q.character = true
                    end
                    
                    @highline.say("<%= color(%Q{#{name_out}}, :name) %> <%= color(':',:separator) %> <%= color('#{'*' * 20}', :private) %>")
                else
                    hsay value, :value
                end
            end
            @stdout.puts
        end
    else
        hsay "No matching records were found.", :information
    end
end