swathesis icon indicating copy to clipboard operation
swathesis copied to clipboard

swth: do not ignore keyword arguments after positional argument

Open LinqLover opened this issue 1 year ago • 6 comments

Previously, swth go --biber would silently use biblatex. Now it works!

LinqLover avatar May 07 '24 23:05 LinqLover

I don't get it, can you give an example?

krono avatar May 08 '24 20:05 krono

On second thought, No, swth go is not meant to take options. It really should take info from the .swth file

krono avatar May 08 '24 20:05 krono

Before, all keyword arguments after the command were silently ignored. While swth --dry-run go did a dry run as expected, swth go --dry-run did an actual run. It's just about typing convenience. (Personally, I think --dry-run is simpler than modifying the .swth file for a single invocation, but that's just an opinion ...)

It's the same for swth create and others. Unless you want to eliminate all keyword arguments in this script, this patch will make sure that they are not ignored just because they appear after instead of before the command. Nothing else. :-)

LinqLover avatar May 08 '24 22:05 LinqLover

I understand.

But I disagree. The options ought to come before the command, because all arguments after the command are intended to be passed through. So

swth latex -interaction=nonstopmode

or

swth --dry-run latex -interaction=nonstopmode

ought to work.

It still does make only little sense for swth go

krono avatar May 13 '24 07:05 krono

The options ought to come before the command, because all arguments after the command are intended to be passed through.

Ah, now I see! Thanks for the explanation! Do you think it would make sense to alter

https://github.com/krono/swathesis/blob/08dfb005c9f983c20225fddf6d968bdcb4e22641/swth#L15

like

USAGE="Usage: $PROGRAM [OPTIONS] COMMAND [COMMAND_OPTIONS]

to avoid future confusion in naive script users like me? :)

LinqLover avatar May 13 '24 13:05 LinqLover

Well if you care that much. swth is merely a tiny helper from times long before I knew arara or latexmk. So keeping this in mind, it is just a tiny tool :)

krono avatar May 14 '24 07:05 krono