From 2d9029183ac02c8c441eab40878bfd6d5ee3ad9b Mon Sep 17 00:00:00 2001 From: Jorge Morante Date: Thu, 21 Sep 2023 15:51:22 +0200 Subject: [PATCH] handle case where no @fingers-* option is defined --- src/fingers/commands/load_config.cr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fingers/commands/load_config.cr b/src/fingers/commands/load_config.cr index 7e08275..fb90a70 100644 --- a/src/fingers/commands/load_config.cr +++ b/src/fingers/commands/load_config.cr @@ -147,7 +147,10 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base end def fingers_options_names - @fingers_options_names ||= `tmux show-options -g | grep ^@fingers`.chomp.split("\n").map { |line| line.split(" ")[0] } + @fingers_options_names ||= `tmux show-options -g | grep ^@fingers` + .chomp.split("\n") + .map { |line| line.split(" ")[0] } + .reject { |option| option.empty? } end def unset_tmux_option!(option) @@ -169,7 +172,7 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base fingers_options_names.each do |option| unless valid_option?(option) - errors << "#{option} is not a valid option" + errors << "'#{option}' is not a valid option" unset_tmux_option!(option) end end