From 3cf707d1c2d58856cc5ff0eba694002e8b205917 Mon Sep 17 00:00:00 2001 From: iberianpig Date: Fri, 27 Sep 2024 00:16:10 +0900 Subject: [PATCH] fix: error handling for invalid option --- exe/fusuma-sendkey | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exe/fusuma-sendkey b/exe/fusuma-sendkey index 360a517..c1d07db 100755 --- a/exe/fusuma-sendkey +++ b/exe/fusuma-sendkey @@ -19,7 +19,13 @@ opt.on('--version', 'Show version') do |v| option[:version] = v end -opt.parse!(ARGV) +begin + opt.parse!(ARGV) +rescue OptionParser::InvalidOption => e + warn e + warn opt.help + exit 1 +end device_name = Fusuma::Config.instance.fetch_config_params( :device_name,