Skip to content

Commit 3fd5961

Browse files
committed
Update cli
1 parent df8b7ce commit 3fd5961

2 files changed

Lines changed: 36 additions & 8 deletions

File tree

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
# package_validator
2-
PLANMAP packages validation framework
1+
# PLANMAP package validator
2+
3+
This tool validates the structure and content of a Planmap package.
4+
5+
The validator gets as input the path to a (PM) package and then
6+
run a series of checks following a package/data model.
7+
8+
## To run the validator
9+
10+
Since I'm trying different methods to have this validator steps running together, there are different ways to run _a_ validator.
11+
12+
* Pytest:
13+
14+
```bash
15+
$ pytest --pkgpath 'path/to/geopackage.gpkg'
16+
```
17+
18+
* Custom (python pipeline):
19+
20+
```bash
21+
$ python validate.py <path>
22+
```
23+
24+
## Where are the models
25+
26+
## How to modify the models

validate.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import gpt
1+
import os
22
import check
33

44
if __name__ == '__main__':
5-
import sys
5+
import argparse
6+
parser = argparse.ArgumentParser(description="Validate Geopackages")
67

7-
if len(sys.argv) < 2:
8-
print("\nUsage: {} <path/to/geopackage>".format(sys.argv[0]))
9-
sys.exit(1)
8+
parser.add_argument('gpkg', type=str,
9+
help="File/path to Geopackage")
10+
11+
args = parser.parse_args()
12+
13+
filename = args.gpkg
14+
assert os.path.isfile(filename), f"Filename '{filename}' does not exist"
1015

11-
filename = sys.argv[1]
1216
check.geopackage(filename)

0 commit comments

Comments
 (0)