Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Prepend task to contents of Tasks file #4

Open
heliostatic opened this issue Jan 11, 2021 · 0 comments
Open

Suggestion: Prepend task to contents of Tasks file #4

heliostatic opened this issue Jan 11, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@heliostatic
Copy link

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)
@macedotavares macedotavares added the enhancement New feature or request label Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants