Skip to content

Commit

Permalink
Merge pull request #14 from marcpage/users/marcp/vi_validate
Browse files Browse the repository at this point in the history
Adding vi_validate command line tool
  • Loading branch information
marcpage authored Mar 13, 2023
2 parents d322d4e + d509a9f commit fbf2b32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
18 changes: 13 additions & 5 deletions pylavi/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ def parse_args(command_line=None):
action="append",
help="File extensions to evaluate (defaults to all known)",
)
parser.add_argument(
"-q",
"--quiet",
action="count",
help="Reduce the output (multiple times reduces output more)",
)
args = parser.parse_args(args=command_line)
args.path = args.path or [""]
args.skip = args.skip or []
args.quiet = args.quiet or 0
has_comparison = args.lt or args.gt or args.eq
has_phase = (
args.no_release
Expand Down Expand Up @@ -159,7 +166,7 @@ def validate(args, resources, problems, next_path):
problems.append(("no-invalid", version_string, next_path))
break

if len(problems) > problem_count:
if len(problems) > problem_count and args.quiet < 1:
print(
f"FAIL: {problems[-1][0]} saved in version {problems[-1][1]}: {problems[-1][2]}"
)
Expand All @@ -183,9 +190,10 @@ def find_problems(args, files):

except AssertionError as error:
problems.append((error, "", next_path))
print(
f"FAIL: {problems[-1][0]} saved in version {problems[-1][1]}: {problems[-1][2]}"
)
if args.quiet < 2:
print(
f"FAIL: {problems[-1][0]} saved in version {problems[-1][1]}: {problems[-1][2]}"
)

return problems

Expand All @@ -196,7 +204,7 @@ def main(args=None):
files = start_finding_files(*args.path)
problems = find_problems(args, files)

if len(problems) > 0:
if len(problems) > 0 and args.quiet < 3:
print(f"{len(problems)} problems encounted")
sys.exit(1)

Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def get_version():
+ "reverse-engineering development"
),
packages=find_packages(),
entry_points={"console_scripts": ["lv_assembler = pylavi.assembler:main"]},
entry_points={
"console_scripts": ["lv_assembler = pylavi.assembler:main"],
"console_scripts": ["vi_validate = pylavi.validate:main"],
},
project_urls={
"Bug Reports": "https://github.com/marcpage/pylavi/issues",
"Source": "https://github.com/marcpage/pylavi/",
Expand Down

0 comments on commit fbf2b32

Please sign in to comment.