Skip to content

Commit

Permalink
Cleaned and added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbn committed Oct 13, 2024
1 parent d0488b2 commit 3aaf262
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pwc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!python3

# This little helper script was implemented to extract the sources from the spellcheck configuration file
# The name comes from Python WCMatch, which is used to match the files against the sources
# That is the short name I call it PriceWaterhouseCoopers, since it revises the file listing

# read file and interpret it as yaml
def read_yaml(file):

Expand All @@ -9,7 +13,6 @@ def read_yaml(file):

import sys
import yaml
#import pprint
from wcmatch import glob

# read filename from command line as first argument
Expand All @@ -20,22 +23,14 @@ def read_yaml(file):
# fetch the sources from the YAML data
sources = data.get('matrix')[0].get('sources')

# print the sources from the YAML data
#pprint.pprint(sources)

for changed_file in sys.stdin:
if 'q' == changed_file.rstrip():
break
changed_file = changed_file.rstrip()
#print(f'Input : {changed_file}')

matched = glob.globmatch(changed_file, sources, flags=glob.NEGATE | glob.GLOBSTAR | glob.SPLIT)

if matched:
#print("Matched file:", changed_file)
exit(0)
else:
#print("No match for file:", changed_file)
exit(1)

#pprint.pprint(files)

0 comments on commit 3aaf262

Please sign in to comment.