Sha256: 089c17ff2880011e8d278a8a405bfc461453b705dcb6d1cc1f18a08e34074f0d

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

require 'lockr/action/base'

class RemoveAction < BaseAction
  
  def initialize(id,username,keyfile,vault)
    super( keyfile, vault)
    
    pwd_directory = @pwdmgr.list()
    
    unless pwd_directory.has_key?( id)
      puts "Id '#{id}' not found"
      exit 20
    end
    
    pwd_directory_id = pwd_directory[id]
    
    unless pwd_directory_id.has_key?(username)
      puts "Username '#{username}' not found for id '#{id}'"
      exit 21
    end
    
    confirm = ask( "Are you sure you want to delete the entry with id '#{id}' and username '#{username}'? (y/n)  ") { |q| }
    unless confirm.downcase == 'y'
      exit 22
    end
    
    @pwdmgr.delete( id, username)
    puts "Entry removed"
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lockr-0.5.2 lib/lockr/action/remove.rb
lockr-0.5.1 lib/lockr/action/remove.rb
lockr-0.5.0 lib/lockr/action/remove.rb