working task note
This commit is contained in:
		
							parent
							
								
									e00be907bf
								
							
						
					
					
						commit
						bb54a114c2
					
				|  | @ -31,6 +31,7 @@ in | ||||||
| 
 | 
 | ||||||
|   environment.systemPackages = with pkgs; [ |   environment.systemPackages = with pkgs; [ | ||||||
|     pinentry_gnome |     pinentry_gnome | ||||||
|  |     cached-nix-shell | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   services.devmon.enable = true; |   services.devmon.enable = true; | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| #!/usr/bin/env python | #! /usr/bin/env cached-nix-shell | ||||||
|  | #! nix-shell -i python3 -p python3 | ||||||
| 
 | 
 | ||||||
| """Manage Taskwarrior notes""" | """Manage Taskwarrior notes""" | ||||||
| 
 | 
 | ||||||
|  | @ -33,11 +34,15 @@ def write_note(task_id: int): | ||||||
|     if not os.path.exists(notes_file): |     if not os.path.exists(notes_file): | ||||||
|         logging.info("Adding description to empty notes file") |         logging.info("Adding description to empty notes file") | ||||||
|         task_description = os.popen(f"task _get {task_id}.description").read() |         task_description = os.popen(f"task _get {task_id}.description").read() | ||||||
|  |         task_project = os.popen(f"task _get {task_id}.project").read().strip("\n") | ||||||
|  |         task_tags = os.popen(f"task _get {task_id}.tags").read().split(",") | ||||||
|  |         if len(task_tags): | ||||||
|  |             task_tags = ":".join(task_tags).strip("\n") + ":" | ||||||
|         time = datetime.datetime.now().strftime("%y-%m-%d %H:%M") |         time = datetime.datetime.now().strftime("%y-%m-%d %H:%M") | ||||||
| 
 | 
 | ||||||
|         with open(notes_file, "w") as f: |         with open(notes_file, "w") as f: | ||||||
|             f.write(f"%title: {task_description}\n") |             f.write(f"%title: {task_description}") | ||||||
|             f.write(":task:\n") |             f.write(f":task:{task_project}:{task_tags if len(task_tags) else ''}\n") | ||||||
|             f.write(f"%date: {time}\n\n") |             f.write(f"%date: {time}\n\n") | ||||||
|             f.flush() |             f.flush() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue