taskai-cli 1.1.1__tar.gz → 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/.gitignore +1 -0
  2. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/PKG-INFO +1 -1
  3. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/pyproject.toml +1 -1
  4. taskai_cli-1.1.4/scripts/bump_version.py +37 -0
  5. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/cli.py +28 -1
  6. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/models.py +1 -0
  7. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/test/test_view.py +7 -1
  8. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/.github/workflows/publish-to-pypi.yml +0 -0
  9. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/DEVLOG.md +0 -0
  10. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/README.md +0 -0
  11. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/docs/index.md +0 -0
  12. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/migrations/_001_removing_lists.py +0 -0
  13. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/migrations/convert_title_to_name.py +0 -0
  14. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/mkdocs.yml +0 -0
  15. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/config.py +0 -0
  16. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/help_menu.py +0 -0
  17. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/json_dir_database.py +0 -0
  18. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/services/ai.py +0 -0
  19. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/services/pomodoro.py +0 -0
  20. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/services/repair_database.py +0 -0
  21. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/services/user_setup.py +0 -0
  22. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/taskai/views.py +0 -0
  23. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/test/test_cli.py +0 -0
  24. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/test/test_execution.py +0 -0
  25. {taskai_cli-1.1.1 → taskai_cli-1.1.4}/test/test_json_dir_database.py +0 -0
@@ -16,3 +16,4 @@ tmp*/
16
16
  _tmp_database_dir/
17
17
  .dev
18
18
  .prod
19
+ *.swo
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: taskai-cli
3
- Version: 1.1.1
3
+ Version: 1.1.4
4
4
  Author-email: Alex Paskal <alexcpaskal@gmail.com>
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: google-genai>=2.8
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "taskai-cli"
3
- version = "1.1.1"
3
+ version = "1.1.4"
4
4
  description = ""
5
5
  authors = [{name = "Alex Paskal", email = "alexcpaskal@gmail.com"}]
6
6
  readme = "README.md"
@@ -0,0 +1,37 @@
1
+ import sys
2
+ import os
3
+ import tomlkit
4
+
5
+ projdir = os.path.dirname(os.path.dirname(__file__))
6
+ with open(os.path.join(projdir, "pyproject.toml")) as f:
7
+ toml = tomlkit.load(f)
8
+
9
+ major, minor, bugfix = list(map(int, toml["project"]["version"].split(".")))
10
+
11
+ args = sys.argv[1:]
12
+
13
+ if not args:
14
+ bugfix += 1
15
+ elif args[0] == "bugfix":
16
+ bugfix += 1
17
+ elif args[0] == "minor":
18
+ minor += 1
19
+ bugfix = 0
20
+ elif args[0] == "major":
21
+ major += 1
22
+ minor = 0
23
+ bugfix = 0
24
+ else:
25
+ print("didn't work")
26
+ print(args)
27
+ sys.exit(-1)
28
+
29
+ new_version = f"{major}.{minor}.{bugfix}"
30
+ print("Bumping to version {}".format(new_version))
31
+ toml["project"]["version"] = new_version
32
+
33
+
34
+ with open(os.path.join(projdir, "pyproject.toml"), "w") as f:
35
+ tomlkit.dump(toml, f)
36
+
37
+
@@ -208,6 +208,30 @@ class Controller:
208
208
  db.update_item(src_id, dependency_ids=dependency_ids)
209
209
  db.commit()
210
210
 
211
+ def reorder(id1: int, id2: int, position: str):
212
+ if position not in ("before", "after"):
213
+ Controller.throw_error("position must be one of before, after")
214
+
215
+ child1 = db.get_item(id1)
216
+ parent = db.get_item(child1.parent_id)
217
+ if parent is None:
218
+ Controller.throw_error("Cannot reorder root items")
219
+
220
+
221
+ new_child_ids = []
222
+ for child_id in parent.child_ids:
223
+ if child_id == id1:
224
+ continue
225
+ if child_id == id2:
226
+ new_child_ids.extend(
227
+ [id1, id2] if position == "before" else [id2, id1]
228
+ )
229
+ continue
230
+ new_child_ids.append(child_id)
231
+ db.update_item(parent.id, child_ids=new_child_ids)
232
+ db.commit()
233
+
234
+
211
235
  # utilities
212
236
  def _parse_arg_string(arg_string: str) -> list[str]:
213
237
  """parses a string properly before dispatching it to the argument parser"""
@@ -309,7 +333,10 @@ def execute_commands(*args, **kwargs) -> int:
309
333
 
310
334
  case "update":
311
335
  Controller.update_item(args[1], **kwargs)
312
-
336
+
337
+ case "reorder":
338
+ Controller.reorder(int(args[1]), int(args[3]), args[2])
339
+
313
340
  case "delete" | "remove":
314
341
  match args[1]:
315
342
  case _ if _is_int(args[1]): Controller.delete_item(args[1])
@@ -44,6 +44,7 @@ class TodoItem(Base):
44
44
  recurs_every: Optional[list[timedelta]] = None
45
45
  recurs_until: Optional[datetime] = None
46
46
  recur_keep_incomplete: bool = False
47
+ status: str = ""
47
48
 
48
49
 
49
50
  class Comment(Base):
@@ -33,12 +33,18 @@ def _populate_db():
33
33
  ids.update(locals())
34
34
 
35
35
  def test_view_lists():
36
+ _cleanup_db()
37
+ _setup_db()
38
+ _populate_db()
36
39
  print("Root 1");print("-"*30)
37
40
  view_lists(db, [ids["root1"]])
38
41
  print("\n\n\n");print("Root 1");print("-"*30)
39
42
  view_lists(db, [ids["root2"]])
40
43
 
41
44
  def test_view_item():
45
+ _cleanup_db()
46
+ _setup_db()
47
+ _populate_db()
42
48
  print("\n\n\n");print("Grandchild");print("-"*30)
43
49
  view_item(db, ids["gchild1"])
44
50
  print("\n\n\n");print("Grandchild");print("-"*30)
@@ -57,4 +63,4 @@ if __name__ == "__main__":
57
63
  # import rich
58
64
  # import orjson as json
59
65
  # rich.print_json(json.dumps(_test_db.user_data).decode())
60
- _cleanup_db()
66
+ _cleanup_db()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes