kcd icon indicating copy to clipboard operation
kcd copied to clipboard

Negative seek values don't work, parsing fails for kcd mpris seek -10s

Open Rishabh672003 opened this issue 1 month ago • 1 comments

kcd mpris seek --help lists -10s as an example, but a negative offset is rejected:

$ kcd mpris seek -10s
Incorrect Usage: flag provided but not defined: -10s

urfave/cli treats any argument starting with - as a flag, so backward seeks can't be written the documented way.

Workaround: kcd mpris seek -- -10s.

I came up with a solution in this commit but its a hack https://github.com/Rishabh672003/kcd/commit/009faff14e73f00d5b22d8ee3285d4df01f17cf6

We can do manual parsing for it, but even that doesnt seem good. or just say in help, for negetive seek use kcd mpris seek -- -10s

Rishabh672003 avatar Oct 04 '26 12:10 Rishabh672003

urfave/cli supports skipping flag parsing on specific cli command.

https://github.com/urfave/cli/blob/2f64589904992914a49b1c1869eba269e580bc5d/command_run.go#L163-L170

we could scope it to the seek command and do the parsing ourself.

that is what i went with since kcd mpris seek -- -10s doesn't look as natural (still works)

tested locally:

 kcd mpris seek -10s
 kcd mpris seek +1m
 kcd mpris seek -2m4s

all work as expected

bethropolis avatar Oct 04 '26 23:10 bethropolis