Strip lines correctly
This commit is contained in:
parent
9e053c715d
commit
f5c39076fd
13
src/main.py
13
src/main.py
|
@ -17,22 +17,23 @@ def create_log_entry(raw_borg_output: list):
|
||||||
attributes = {"Archive name: ": "",
|
attributes = {"Archive name: ": "",
|
||||||
"Archive fingerprint: ": "",
|
"Archive fingerprint: ": "",
|
||||||
"Time (start): ": "",
|
"Time (start): ": "",
|
||||||
|
"Time (end): ": "",
|
||||||
"Duration: ": "",
|
"Duration: ": "",
|
||||||
"Number of files: ": ""}
|
"Number of files: ": ""}
|
||||||
|
|
||||||
for i in range(0, len(raw_borg_output)):
|
for line in raw_borg_output:
|
||||||
for key in attributes:
|
for key in attributes:
|
||||||
if raw_borg_output[i].startswith(key):
|
if line.startswith(key):
|
||||||
attributes[key] = raw_borg_output[i] \
|
attributes[key] = line[len(key):].strip()
|
||||||
.strip(key) \
|
|
||||||
.rstrip()
|
|
||||||
|
|
||||||
return LogEntry(attributes["Archive name: "],
|
return LogEntry(attributes["Archive name: "],
|
||||||
attributes["Archive fingerprint: "],
|
attributes["Archive fingerprint: "],
|
||||||
attributes["Time (start): "],
|
attributes["Time (start): "],
|
||||||
|
attributes["Time (end): "],
|
||||||
attributes["Duration: "],
|
attributes["Duration: "],
|
||||||
attributes["Number of files: "])
|
attributes["Number of files: "])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(stdin.readlines())
|
input_text = stdin.readlines()
|
||||||
|
main(input_text)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user