forked from cmccabe/linkulator2
Merge branch 'noDataWarningBugfix' of cmccabe/linkulator2 into master
This commit is contained in:
commit
b736cd0b6e
56
linkulator
56
linkulator
|
@ -72,38 +72,36 @@ def build_menu():
|
|||
)
|
||||
linkulator_files = glob(files_pattern)
|
||||
|
||||
if len(linkulator_files) == 0:
|
||||
global link_data
|
||||
linkulator_lines = []
|
||||
for filename in linkulator_files:
|
||||
with open(filename) as f:
|
||||
# get file owner username from path
|
||||
file_owner = PurePath(filename).parent.parent.name
|
||||
if file_owner in ignore_names:
|
||||
# ignore names found in ignore file
|
||||
continue
|
||||
for line in f:
|
||||
if line.count("|") != pipe_count:
|
||||
# ignore lines that fail validation
|
||||
continue
|
||||
line = line.rstrip("\n")
|
||||
split_line = line.split("|")
|
||||
split_line.insert(0, file_owner)
|
||||
linkulator_lines.append(split_line) ## creating a list of lists
|
||||
|
||||
if len(linkulator_lines) == 0:
|
||||
print("It looks link there are no links yet. Run 'linkulator -p' to add one.")
|
||||
exit()
|
||||
|
||||
else:
|
||||
|
||||
global link_data
|
||||
linkulator_lines = []
|
||||
for filename in linkulator_files:
|
||||
with open(filename) as f:
|
||||
# get file owner username from path
|
||||
file_owner = PurePath(filename).parent.parent.name
|
||||
if file_owner in ignore_names:
|
||||
# ignore names found in ignore file
|
||||
continue
|
||||
for line in f:
|
||||
if line.count("|") != pipe_count:
|
||||
# ignore lines that fail validation
|
||||
continue
|
||||
line = line.rstrip("\n")
|
||||
split_line = line.split("|")
|
||||
split_line.insert(0, file_owner)
|
||||
linkulator_lines.append(split_line) ## creating a list of lists
|
||||
|
||||
i = 1
|
||||
for idx, line in enumerate(linkulator_lines):
|
||||
if line[2] == "": # CREATE/INSERT PARENT ID:
|
||||
linkulator_lines[idx].insert(0, i)
|
||||
i = i + 1
|
||||
else: ## NOT PARENT, SO NO PARENT ID
|
||||
linkulator_lines[idx].insert(0, "")
|
||||
link_data = linkulator_lines
|
||||
i = 1
|
||||
for idx, line in enumerate(linkulator_lines):
|
||||
if line[2] == "": # CREATE/INSERT PARENT ID:
|
||||
linkulator_lines[idx].insert(0, i)
|
||||
i = i + 1
|
||||
else: ## NOT PARENT, SO NO PARENT ID
|
||||
linkulator_lines[idx].insert(0, "")
|
||||
link_data = linkulator_lines
|
||||
|
||||
## THIS IS SUPPOSED TO SORT ALL LINKS BY CREATION DATE. NEED TO CONFIRM THAT IT WORKS.
|
||||
link_data.sort(key=lambda x: x[2])
|
||||
|
|
Loading…
Reference in New Issue
Block a user