Skip to content

Commit

Permalink
chore: Make stress_test_obsidian_tasks.py add created and due dates
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Mar 25, 2024
1 parent 4f11d21 commit dabb609
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/stress_test_obsidian_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
# Generate some files containing tasks, to stress-test the Tasks plugin.

import os.path
from datetime import datetime

files_to_write = 50
list_items_to_write = 100
add_task_every_n_lines = 1 # 1 or higher

today = datetime.today().strftime('%Y-%m-%d')

def file_content(basename: str, file_index: int, number_of_list_items: int) -> str:
content = ''
content += f'# {basename}\n\n'
content += f'## {basename} - level 2\n\n'
for i in range(1, number_of_list_items + 1):
line_text = f'#task Set {file_index} Task {i} of {number_of_list_items}'
if i % add_task_every_n_lines == 0:
content += f'- [ ] {line_text}\n'
content += f'- [ ] {line_text}{today} 📅 {today}\n'
else:
content += f'- {line_text}\n'
return content
Expand All @@ -34,5 +37,6 @@ def create_files(dir) -> None:

if __name__ == '__main__':
# Run from the root of the vault
create_files('resources/sample_vaults/Tasks-Demo/Stress Test')
print('Done')
output_dir = 'resources/sample_vaults/Tasks-Demo/Stress Test'
create_files(output_dir)
print(f"Done: files written to '{output_dir}'")

0 comments on commit dabb609

Please sign in to comment.