Merge pull request #11654 from bojidar-bg/docstatus-fnmatch

Allow using wildcards to filter docstatus class names
This commit is contained in:
Poommetee Ketson 2017-10-02 23:31:52 +07:00 committed by GitHub
commit 5005818798

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import fnmatch
import os import os
import sys import sys
import re import re
@ -356,8 +357,13 @@ for file in input_file_list:
class_names.sort() class_names.sort()
if len(input_class_list) < 1: if len(input_class_list) < 1:
input_class_list = class_names input_class_list = ['*']
filtered_classes = set()
for pattern in input_class_list:
filtered_classes |= set(fnmatch.filter(class_names, pattern))
filtered_classes = list(filtered_classes)
filtered_classes.sort()
################################################################################ ################################################################################
# Make output table # # Make output table #
@ -369,10 +375,7 @@ table_column_chars = '|'
total_status = ClassStatus('Total') total_status = ClassStatus('Total')
for cn in input_class_list: for cn in filtered_classes:
if not cn in classes:
print('Cannot find class ' + cn + '!')
sys.exit(255)
c = classes[cn] c = classes[cn]
validate_tag(c, 'class') validate_tag(c, 'class')