Skip to content

Commit

Permalink
add option --enable-python to clingo entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed Jun 27, 2024
1 parent 423c22a commit d226fa6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion libpyclingo/clingo/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""
Module providing the clingo-like pyclingo application.
"""
from clingo import Application, clingo_main

from clingo.application import Application, ApplicationOptions, Flag, clingo_main
from clingo.script import enable_python


class PyClingoApplication(Application):
Expand All @@ -11,7 +13,23 @@ class PyClingoApplication(Application):

program_name = "pyclingo"

def __init__(self):
self._enable_python = Flag()

def register_options(self, options: ApplicationOptions):
"""
Register additional options.
"""
options.add_flag(
"Basic Options",
"enable-python",
"Enable Python script tags",
self._enable_python,
)

def main(self, control, files):
if self._enable_python:
enable_python()
for file_ in files:
control.load(file_)
if not files:
Expand Down

0 comments on commit d226fa6

Please sign in to comment.