Skip to content

Suggestion: Prepend task to contents of Tasks file #4

@heliostatic

Description

@heliostatic

Currently, adding a Task to the Task file appends it to the specified section. It would be trivial to prepend it to the existing contents of the section, but might be nice to have a setting to specify where to put new tasks in the Task file section.

The code (which I guess lives in the plist?) would be here:

find = re.compile(r'^(## ' + re.escape(heading) + r'\n.*?)\n+#', flags = re.MULTILINE|re.DOTALL)
replace = '\\1\n- ' + entry + '\n\n#'

if re.findall(find, original_content) == []:
	new_content = original_content + '## ' + heading + '\n- ' + entry + '\n\n#'
else:
	new_content = re.sub(find, replace, original_content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions