summaryrefslogtreecommitdiff
path: root/note_tools/tomorrow.py
diff options
context:
space:
mode:
Diffstat (limited to 'note_tools/tomorrow.py')
-rw-r--r--note_tools/tomorrow.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/note_tools/tomorrow.py b/note_tools/tomorrow.py
new file mode 100644
index 0000000..2198a3b
--- /dev/null
+++ b/note_tools/tomorrow.py
@@ -0,0 +1,27 @@
1from . import NoteBaseCommand
2import os
3from datetime import timedelta
4import sublime
5import sublime_plugin
6
7class NewNoteForTomorrowCommand(NoteBaseCommand, sublime_plugin.WindowCommand):
8 def run(self):
9 self.date = self.get_date() + timedelta(days=1)
10
11 notes_path = self.get_notes_path(self.window.project_data())
12
13 if notes_path:
14 year, month = self.get_date_parts()
15 directory = os.path.join(notes_path, year, month)
16 os.makedirs(directory, exist_ok=True)
17 file_path = os.path.join(directory, self.file_name())
18
19 # Check if file already exists
20 if os.path.exists(file_path):
21 sublime.message_dialog(f"The file '{self.file_name()}' already exists.")
22 else:
23 self.write_file_heading(file_path)
24
25 else:
26 sublime.message_dialog("No 'Notes' directory found in the project. Please add a 'Notes' folder.")
27