krieselreihe / litr

Litr (Language Independent Task Runner) lets you configure and then run any tasks you want for any language.
MIT License
8 stars 0 forks source link

Command and parameter names containing a hyphen cannot be executed #58

Closed MartinHelmut closed 2 years ago

MartinHelmut commented 2 years ago

Description

Given the following configuration:

[commands]
some-command = "echo %{some-param}"

[params]
some-param = "Yes, do it"

Running this:

litr some-command --some-param=Name

Will result in:

Error: Problem parsing command line arguments!
  → /path/to/litr.toml
1 | some-command
  |            └─ Cannot parse: A short parameter can only contain one character (A-Za-z).

Also, trying to parse the parameter variable inside the script will print a duplicated error message that the parameter name cannot be parsed:

Error: Problem parsing script!
  → /path/to/litr.toml
2 | build = "echo %{some-param}"
  |                     └─ Cannot parse: Unexpected character.
 ...
2 | build = "echo %{some-param}"
  |                     └─ Cannot parse: Unexpected character.

Problem

Even though valid, commands and parameters containing a hyphen will be wrongly parsed as "short parameter names" and result in parsing issues inside the script parser.