Thus, in your first example --on-error=halt is handled as an application option. The optional -- after the file is needed if the first application argument is *.pl. You get the application arguments using the Prolog flag argv. See also library(main).