-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better option handling in demo server
- Loading branch information
1 parent
5b52f6d
commit 8f30833
Showing
1 changed file
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
Author: Jan Wielemaker | ||
E-mail: [email protected] | ||
WWW: http://www.swi-prolog.org | ||
Copyright (c) 2022-20244, SWI-Prolog Solutions b.v. | ||
Copyright (c) 2022-2024, SWI-Prolog Solutions b.v. | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
|
@@ -79,17 +79,24 @@ | |
:- endif. | ||
|
||
|
||
:- initialization(server_loop, main). | ||
:- initialization(main, main). | ||
|
||
opt_type(port, port, nonneg). | ||
opt_type(p, port, nonneg). | ||
opt_type(interactive, interactive, boolean). | ||
opt_type(i, i, boolean). | ||
|
||
opt_type(port, port, nonneg). | ||
opt_help(port, "Port to listen to (default 8080)"). | ||
opt_help(interactive, "Become interactive"). | ||
|
||
server :- | ||
current_prolog_flag(argv, Argv), | ||
argv_options(Argv, _Positonal, Options), | ||
server(Options) :- | ||
merge_options(Options, [port(8080)], Options1), | ||
http_server(Options1). | ||
|
||
server_loop :- | ||
server, | ||
thread_get_message(quit). | ||
main(Argv) :- | ||
argv_options(Argv, _Pos, Options), | ||
server(Options), | ||
( option(interactive(true), Options) | ||
-> cli_enable_development_system | ||
; thread_get_message(quit) | ||
). |