diff --git a/makesure.awk b/makesure.awk index 863f662..285e7b5 100755 --- a/makesure.awk +++ b/makesure.awk @@ -896,7 +896,7 @@ function parseCli_2(line, vars, vars2, res, pos,c,c1,isDoll,q,var,inDef,defVal while ((c = substr(line, ++pos, 1)) != "" && c != " " && c != "\t") { # whitespace denotes the end of arg w = w c } - if (w !~ /^[_A-Za-z0-9@.]+$/) + if (w !~ /^[-_A-Za-z0-9@.]+$/) return "wrong unquoted: '" w "'" res[i = +res[-7]++, "quote"] = "u" res[i] = w diff --git a/tests/16_define_validation.tush b/tests/16_define_validation.tush index 5eb4a74..8f6c35f 100644 --- a/tests/16_define_validation.tush +++ b/tests/16_define_validation.tush @@ -29,6 +29,7 @@ $ ./$MAKESURE -f tests/16_define_validation_pass.sh | EC1=eee | KC1=aaabbbcc'ca b ceee | LC1=aaabbb bbbcc'c cc'ca b ceee eee +| IL5=a-b $ ./$MAKESURE -f tests/16_define_validation_error.sh @ Invalid @define syntax, should be @define VAR_NAME 'value': @@ -81,8 +82,6 @@ $ ./$MAKESURE -f tests/16_define_validation_error.sh @ tests/16_define_validation_error.sh:30: @define IL3 a&&b @ Syntax error: wrong unquoted: 'a!b': @ tests/16_define_validation_error.sh:31: @define IL4 a!b -@ Syntax error: wrong unquoted: 'a-b': -@ tests/16_define_validation_error.sh:32: @define IL5 a-b @ Syntax error: wrong unquoted: 'a+b': @ tests/16_define_validation_error.sh:33: @define IL6 a+b @ Syntax error: wrong unquoted: 'a;;;b': @@ -91,7 +90,7 @@ $ ./$MAKESURE -f tests/16_define_validation_error.sh @ tests/16_define_validation_error.sh:36: @define 0wrong_name 123 @ Syntax error: wrong unquoted: 'wrong,name': @ tests/16_define_validation_error.sh:37: @define wrong,name 123 -@ Syntax error: wrong unquoted: 'wrong-name': +@ Wrong variable name: 'wrong-name': @ tests/16_define_validation_error.sh:38: @define wrong-name 123 ? 1 diff --git a/tests/16_define_validation_error.sh b/tests/16_define_validation_error.sh index e89abd8..b68308c 100644 --- a/tests/16_define_validation_error.sh +++ b/tests/16_define_validation_error.sh @@ -29,7 +29,7 @@ @define IL2 a&b @define IL3 a&&b @define IL4 a!b -@define IL5 a-b + @define IL6 a+b @define IL7 a;;;b diff --git a/tests/16_define_validation_pass.sh b/tests/16_define_validation_pass.sh index 037d589..7505bcf 100644 --- a/tests/16_define_validation_pass.sh +++ b/tests/16_define_validation_pass.sh @@ -31,9 +31,10 @@ @define KC1 $'aaabbbcc\'ca b ceee' # some comment @define LC1 "$A$B$C$D$E" # other comment +@define IL5 a-b + @goal default - for x in EMPTY EMPTY1 EMPTY2 EMPTY3 _a123 good__NaMe_ A B B1 B2 C C1 D D1 D2 E F K L AC1 AC2 BC1 BC2 CC1 DC1 EC1 KC1 LC1 -# for x in EMPTY1 EMPTY2 EMPTY3 _a123 good__NaMe_ A B B1 B2 C C1 D D1 D2 E F K L AC1 AC2 BC1 BC2 CC1 DC1 EC1 KC1 LC1 + for x in EMPTY EMPTY1 EMPTY2 EMPTY3 _a123 good__NaMe_ A B B1 B2 C C1 D D1 D2 E F K L AC1 AC2 BC1 BC2 CC1 DC1 EC1 KC1 LC1 IL5 do printf '%-3s=%s\n' "$x" "${!x}" done diff --git a/tests/1_goals.sh b/tests/1_goals.sh index 7424d33..3e8796d 100644 --- a/tests/1_goals.sh +++ b/tests/1_goals.sh @@ -29,4 +29,4 @@ echo >&2 stderr exit 123 - +@goal good-name # should not cause error diff --git a/tests/1_goals.tush b/tests/1_goals.tush index 1363384..a8dfeb8 100644 --- a/tests/1_goals.tush +++ b/tests/1_goals.tush @@ -25,12 +25,13 @@ $ ./$MAKESURE -f tests/1_goals.sh --silent $ ./$MAKESURE -f tests/1_goals.sh -l | Available goals: | default -| aaa : Documenatation for aaa -| bbb : Documenatation for bbb +| aaa : Documenatation for aaa +| bbb : Documenatation for bbb | ccc | ddd | fail | fail123 +| good-name $ ./$MAKESURE -f tests/1_goals.sh -d | Resolved goals to reach for 'default':