Skip to content

Commit

Permalink
added output header print for cli call
Browse files Browse the repository at this point in the history
  • Loading branch information
hweichelt committed Aug 8, 2023
1 parent 60f6dd2 commit 12c3e9d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/clingexplaid/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Command Line Interface Utilities
"""

import configparser
from pathlib import Path

from clingo.application import Application

from clingexplaid.utils import get_solver_literal_lookup
Expand Down Expand Up @@ -51,12 +54,19 @@ def register_options(self, options):
)

def main(self, control, files):
setup_file_path = Path(__file__).parent.joinpath("../../../setup.cfg")
setup_config = configparser.ConfigParser()
setup_config.read(setup_file_path)
metadata = setup_config["metadata"]
print(metadata["name"], "version", metadata["version"])
signature_set = set(self.signatures.items()) if self.signatures else None
at = AssumptionTransformer(signatures=signature_set)
if not files:
program_transformed = at.parse_files("-")
print("Reading from -")
else:
program_transformed = at.parse_files(files)
print(f"Reading from {files[0]} {'...' if len(files) > 1 else ''}")

control.add("base", [], program_transformed)
control.ground([("base", [])])
Expand All @@ -66,6 +76,8 @@ def main(self, control, files):
assumptions = at.get_assumptions(control)

cc = CoreComputer(control, assumptions)

print("Solving...")
control.solve(assumptions=list(assumptions), on_core=cc.shrink)

if cc.minimal is None:
Expand Down

0 comments on commit 12c3e9d

Please sign in to comment.