runme icon indicating copy to clipboard operation
runme copied to clipboard

Duplicate task name check fails if duplicated tasks are in the same markdown file

Open christian-bromann opened this issue 2 years ago • 3 comments

Given the following markdown file:

```sh { name=foo }
echo "foo"
```

```sh { name=foo }
echo "bar"
```

if I run runme --project . run foo I expect Runme to ask which of the commands to execute since there are two tasks available with the same name.

Actual behavior: it runs the first task

christian-bromann avatar May 22 '23 21:05 christian-bromann

If you check runme ls you'll see that runme automatically adds a numbering to prevent name collisions within the same file:

image

So in this case the second script will be runme --project . run foo-2

mxsdev avatar May 22 '23 21:05 mxsdev

Interesting. I was assuming the same behavior for same tasks within the same file as within different files. I personally favor if runme could throw an error here and have the user fix the naming rather than renaming it automatically. Wdyt?

christian-bromann avatar May 22 '23 21:05 christian-bromann

I'd personally prefer maybe a warning message indicating that the parser automatically renamed a script.

I agree though that the new idiosyncrasy in behavior is pretty unintuitive.

mxsdev avatar May 22 '23 21:05 mxsdev