Swipl comman line: specifying source file name

I was trying to run swipl command line as follows:
swipl --quiet -g do -t halt /somedir/input
It’s error message was
ERROR: -g do: catch/3: Undefined procedure: do/0
Well, do was most certainly in my source file.
Took me quite some time of experimenting with encodings ('cause I need the source to be in UTF-8) - only to figure out that the problem is fixed by adding .pl to the file name and the command line. Works as follows:
swipl --quiet -g do -t halt /somedir/input.pl
I double-checked with man swipl and swi-prolog.org - there is no mention (that I could find) of the need for .pl extension. Am I looking in the wrong direction, or is this a minor bug to be reported? I think silently ignoring a command-line parameter is a bug. I came across my solution accidentally. And it cost me time. Hope this will help someone else save their time.

P.S. removing --quiet did not make swipl any more verbose.

In the manual we find:

If the options are followed by one or more Prolog file names (i.e., names with extension .pl , .prolog or (on Windows) the user preferred extension registered during installation), these files are loaded.

Which doesn’t really invalidate your comment. Clearly it is hard to find this. Warnings are a bit unclear. The command line syntax has been changed several times :frowning: It (roughly) consists of three components, all of which may be empty: (1) options that modify Prolog’s behavior (quiet, stack limits, etc), (2) source files to load and (3) options for the application to pick up using the argv Prolog flag.

Notably (2) can be empty if we call built-in predicates, use -g to load files or rely on an autoload library.

One alternative might be that the first non-Prolog option argument is either -- or a file name to be loaded. Note that for handling #!, we particularly want swipl source-file application option ... to work.

jan, thank you! My bad, I overlooked it in the manual. But I would still suggest that an error message or at least a warning be printed if swipl finds smth on the command line (before "-- ") that it cannot interpret. What do you think?

Before -- would break the common swipl script arg .... What might work is, as I said, demand the Prolog to be followed by a script or --. Anyone sees (compatibility) problems with that?