Skip to content

Commit e377d8c

Browse files
committed
update searchmodels.py
1 parent 76c33a3 commit e377d8c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

searchmodels.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ def parse(self, args):
6262
if __name__ == '__main__':
6363
Options = _Options()
6464
Options.set_values("constraint", "tag", "name")
65-
Options.set_flags("cop", "csp", "reverse", "json", "github", "file", "help", "showtags", "showconstraints")
65+
Options.set_flags("cop", "csp", "reverse", "json", "github", "dir", "help", "showtags", "showconstraints")
6666
Options.parse(sys.argv)
6767

6868
if len(sys.argv) == 1 or (Options.csp and Options.cop) or (Options.json and Options.github):
69-
print("usage: python searchmodels.py [-constraint=Sum] [-tag=xcsp23] [-name='Bacp*'] [-cop|csp] [-reverse] [-json|-file] [-showtags] [-showcontraints]")
69+
print("usage: python searchmodels.py [-constraint=Sum] [-tag=xcsp23] [-name='Bacp*'] [-cop|csp] [-reverse] [-json|-dir|-github] [-showtags] [-showcontraints]")
7070
sys.exit(1)
7171
if Options.help :
72-
print("usage: python searchmodels.py [-constraint=Sum] [-tag=xcsp23] [-name='Bacp'] [-cop|csp] [-reverse] [-json|-file] [-showtags] [-showcontraints]")
72+
print("usage: python searchmodels.py [-constraint=Sum] [-tag=xcsp23] [-name='Bacp'] [-cop|csp] [-reverse] [-json|-dir] [-showtags] [-showcontraints]")
7373
print()
7474
print("Extract problems with respect to a given query. You can mix different queries resulting to all problems that matches all queries. You can also reverse the results.")
7575
print()
@@ -85,6 +85,8 @@ def parse(self, args):
8585
print()
8686
print(" -json display results as a json file")
8787
print(" -github display results as links to github project\n")
88+
print(" -dir display results as directory location\n")
89+
8890
sys.exit(1)
8991
results = []
9092
constraints = []
@@ -154,12 +156,12 @@ def parse(self, args):
154156

155157
if Options.json :
156158
tmp = [model for model in models if model['name'] in results]
157-
print(tmp)
159+
print(json.dumps(tmp, indent=2))
158160
elif Options.github:
159161
for model in models:
160162
if model['name'] in results:
161163
print("https://github.com/xcsp3team/pycsp3-models//tree/main/" + model['fullname'])
162-
elif Options.file:
164+
elif Options.dir:
163165
for model in models:
164166
if model['name'] in results:
165167
print(model['fullname'])

0 commit comments

Comments
 (0)