fmang / opustags

Ogg Opus tags editor
BSD 3-Clause "New" or "Revised" License
75 stars 10 forks source link

Possible smart ordering of CLI switches #5

Closed rr- closed 5 years ago

rr- commented 8 years ago

Right now this call

opustags --add ARTIST=omg --delete ARTIST

adds ARTIST and then deletes the ARTIST, which results in removal of all prior ARTIST entries and not adding ARTIST=omg entry. The proposition is to introduce "smart ordering" (I just called it that) to CLI arguments so that it's always like this:

  1. Global operations such as -e, --import, --delete-all
  2. Deletion operations (--delete)
  3. Update operations (--set)
  4. Insertion operations (--add)

With this, it'd remove all the ARTIST entries and add one ARTIST=omg entry, essentially replacing all artists with omg.

I'm not a fan of this approach since, beside sub-ideal code it needs to introduce, it feels kind of counter-intuitive to me; after all I just told the program to add a tag, and then delete a tag. I'd expect it to do just that - the fact it's a silly thing to do is just my fault for telling it to do something silly.

We could use external opinion on this.

oczki commented 8 years ago

I agree on that it's a bad idea to try to automatically correct user's command without knowing their true intent.

Perhaps an additional flag --fix-ordering-for-me-please (or its opposite, whichever will be default) would be the best of both worlds, provided this flag is known to the user beforehand.

But still, forcibly fixing user's mistakes without their knowledge won't help anyone in the long run.

fmang commented 8 years ago

I see two options:

  1. Make things clear and forbid specifying nonsensical operations (--add then --delete).
  2. Hide these strange behaviors from the man page and let users discovered unexpected possibilities.

Noting also that something like --import --add X=Y --import is strange if we want to preserve the original order. This case is in favor of option 1.