diff --git a/lib/mpw/cli.rb b/lib/mpw/cli.rb index a1533b5..3f4d43d 100644 --- a/lib/mpw/cli.rb +++ b/lib/mpw/cli.rb @@ -218,7 +218,7 @@ class Cli # Display the query's result # @args: options -> the option to search - def list(options = {}) + def list(**options) result = @mpw.list(options) if result.empty? @@ -406,7 +406,7 @@ class Cli # Update an item # @args: password -> generate a random password # options -> the option to search - def update(password = false, options = {}) + def update(password = false, **options) items = @mpw.list(options) if items.empty? @@ -431,7 +431,7 @@ class Cli # Remove an item # @args: options -> the option to search - def delete(options = {}) + def delete(**options) items = @mpw.list(options) if items.empty? @@ -456,7 +456,7 @@ class Cli # Copy a password, otp, login # @args: clipboard -> enable clipboard # options -> the option to search - def copy(clipboard = true, options = {}) + def copy(clipboard = true, **options) items = @mpw.list(options) if items.empty? diff --git a/lib/mpw/item.rb b/lib/mpw/item.rb index f6d90ef..1534cc4 100644 --- a/lib/mpw/item.rb +++ b/lib/mpw/item.rb @@ -35,7 +35,7 @@ class Item # Create a new item # @args: options -> a hash of parameter # raise an error if the hash hasn't the key name - def initialize(options = {}) + def initialize(**options) if !options.key?(:host) || options[:host].to_s.empty? raise I18n.t('error.update.host_empty') end @@ -55,7 +55,7 @@ class Item # Update the item # @args: options -> a hash of parameter - def update(options = {}) + def update(**options) if options.key?(:host) && options[:host].to_s.empty? raise I18n.t('error.update.host_empty') end diff --git a/lib/mpw/mpw.rb b/lib/mpw/mpw.rb index 069a123..46355ec 100644 --- a/lib/mpw/mpw.rb +++ b/lib/mpw/mpw.rb @@ -223,7 +223,7 @@ class MPW # Set config # args: config -> a hash with config options - def set_config(options = {}) + def set_config(**options) @config = {} if @config.nil? @config['protocol'] = options[:protocol] if options.key?(:protocol) @@ -246,7 +246,7 @@ class MPW # Search in some csv data # @args: options -> a hash with paramaters # @rtrn: a list with the resultat of the search - def list(options = {}) + def list(**options) result = [] search = options[:pattern].to_s.downcase