lib/everyday-cli-utils/option.rb in everyday-cli-utils-1.7.1 vs lib/everyday-cli-utils/option.rb in everyday-cli-utils-1.7.2

- old
+ new

@@ -301,11 +301,11 @@ end def defaults_option(file_path, names, settings = {}) @options ||= OptionList.new settings[:file_path] = file_path - @options.register_special(4, :defaults, names, settings[:exit_on_save], 'Defaults set', settings, + @options.register_special(4, :defaults, names, !settings.has_key?(:exit_on_save) || settings[:exit_on_save], 'Defaults set', settings, ->(opt, options) { IO.write(opt.settings[:file_path], options.composite(:local, :arg).to_yaml) }, ->(opt, options) { unless opt.settings[:file_path].nil? || !File.exist?(opt.settings[:file_path]) options.update_all :local, YAML::load_file(opt.settings[:file_path]) @@ -314,11 +314,11 @@ end def global_defaults_option(file_path, names, settings = {}) @options ||= OptionList.new settings[:file_path] = file_path - @options.register_special(3, :global_defaults, names, settings[:exit_on_save], 'Global defaults set', settings, + @options.register_special(3, :global_defaults, names, !settings.has_key?(:exit_on_save) || settings[:exit_on_save], 'Global defaults set', settings, ->(opt, options) { IO.write(opt.settings[:file_path], options.composite(:global, :arg).to_yaml) }, ->(opt, options) { unless opt.settings[:file_path].nil? || !File.exist?(opt.settings[:file_path]) options.update_all :global, YAML::load_file(opt.settings[:file_path]) @@ -326,18 +326,18 @@ }) end def show_defaults_option(names, settings = {}) @options ||= OptionList.new - @options.register_special(2, :show_defaults, names, settings[:exit_on_show], nil, settings, + @options.register_special(2, :show_defaults, names, !settings.has_key?(:exit_on_show) || settings[:exit_on_show], nil, settings, ->(_, options) { puts options.show_defaults }) end def help_option(names, settings = {}) @options ||= OptionList.new - @options.register_special(1, :help, names, settings[:exit_on_print], nil, settings, + @options.register_special(1, :help, names, !settings.has_key?(:exit_on_print) || settings[:exit_on_print], nil, settings, ->(_, options) { puts options.help }) end \ No newline at end of file