File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ #!python3
2+
3+ # read file and interpret it as yaml
4+ def read_yaml (file ):
5+
6+ with open (file ) as f :
7+ data = yaml .safe_load (f )
8+ return data
9+
10+ import sys
11+ import yaml
12+ #import pprint
13+ from wcmatch import glob
14+
15+ # read filename from command line as first argument
16+ spellcheck_configuration_file = sys .argv [1 ]
17+
18+ data = read_yaml (spellcheck_configuration_file )
19+
20+ # fetch the sources from the YAML data
21+ sources = data .get ('matrix' )[0 ].get ('sources' )
22+
23+ # print the sources from the YAML data
24+ #pprint.pprint(sources)
25+
26+ for changed_file in sys .stdin :
27+ if 'q' == changed_file .rstrip ():
28+ break
29+ changed_file = changed_file .rstrip ()
30+ #print(f'Input : {changed_file}')
31+
32+ matched = glob .globmatch (changed_file , sources , flags = glob .NEGATE | glob .GLOBSTAR | glob .SPLIT )
33+
34+ if matched :
35+ #print("Matched file:", changed_file)
36+ exit (0 )
37+ else :
38+ #print("No match for file:", changed_file)
39+ exit (1 )
40+
41+ #pprint.pprint(files)
You can’t perform that action at this time.
0 commit comments