From 41d63d85807ac575b11106cb23f934f285570bb3 Mon Sep 17 00:00:00 2001 From: KRKeegan Date: Wed, 20 Nov 2013 17:27:00 -0800 Subject: [PATCH] Trim Whitespaces in Debug Config Parameter Pounding my head against the wall trying to figure out why 'debug: insteon:4, json' wouldn't work. (Turns out debugging was enabled for ' json', very annoying). This trims all leading and trailing whitespaces around the parameters. It also trims any white space between the ":" allowing for example 'insteon : 4'. Much more user friendly. --- bin/mh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/mh b/bin/mh index 3eb52899e..b57f45bdb 100755 --- a/bin/mh +++ b/bin/mh @@ -386,9 +386,10 @@ EOF $Debug{debug_previous} = $config_parms{debug}; # Allow for multiple debugs like serial;x10 for my $debug (split /[,|;]/, lc $config_parms{debug}) { + $debug =~ s/^\s+|\s+$//g; #Trim whitespace # Allow for debug level like: x10:4 next unless $debug; - if ($debug =~ /(.+):(.+)/) { + if ($debug =~ /\s*(\S+)\s*:\s*(\d+)\s*/) { $Debug{$1} = $2; print "Debug for $1 set to $2\n"; }