Did you know ... | Search Documentation: |
SWI-Prolog app scripts |
As of version 9.1.18, SWI-Prolog allows starting an application using the command below.
swipl [option ...] [path:]name [arg ...]
This command line first processes Prolog options described in
section 2.4. Note that
most standard Prolog commandline options are not relevant. The -f
defaults to none
, which implies that the user init file is
by default not loaded. If an application wishes to load the user init
file, it should load
user_app_config(init)
if this file exists (see
exists_source/1).
Next, it locates path(name)
using SWI-Prolog's file
search mechanism defined by absolute_file_name/3.
After loading this file it finds the last goal registered for main
using initialization/2
as described in section
2.11 - if there is no initization directive for main
,
the program terminates with an error. By default, the application
terminates after the entry point terminates. The entry point may enable
the interactive Prolog REPL loop by calling
cli_enable_development_system/0.
Other forms of the initialization/2
directive are also allowed, in addition to‘main`.
All command line options after [path:]name
are
accessible in the Prolog flag argv.
The optional path defaults to app
. By
default, apps are searched in the directories below. See file_search_path/2
for details.
app
directory of the SWI-Prolog installation /.local/share/swi-prolog/app/
and /usr/share/swi-prolog/app
.app
directory of a Prolog pack.The following apps are provided by the installation
swipl app list
library(prolog_pack)
. For example, to
find packages related to type, use the command below.
swipl pack find type