tasktree 0.0.12__py3-none-any.whl → 0.0.13__py3-none-any.whl
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.
- tasktree/cli.py +45 -3
- {tasktree-0.0.12.dist-info → tasktree-0.0.13.dist-info}/METADATA +1 -1
- {tasktree-0.0.12.dist-info → tasktree-0.0.13.dist-info}/RECORD +5 -5
- {tasktree-0.0.12.dist-info → tasktree-0.0.13.dist-info}/WHEEL +0 -0
- {tasktree-0.0.12.dist-info → tasktree-0.0.13.dist-info}/entry_points.txt +0 -0
tasktree/cli.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
3
5
|
from pathlib import Path
|
|
4
6
|
from typing import Any, List, Optional
|
|
5
7
|
|
|
@@ -26,6 +28,46 @@ app = typer.Typer(
|
|
|
26
28
|
console = Console()
|
|
27
29
|
|
|
28
30
|
|
|
31
|
+
def _supports_unicode() -> bool:
|
|
32
|
+
"""Check if the terminal supports Unicode characters.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
True if terminal supports UTF-8, False otherwise
|
|
36
|
+
"""
|
|
37
|
+
# Hard stop: classic Windows console (conhost)
|
|
38
|
+
if os.name == "nt" and "WT_SESSION" not in os.environ:
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
# Encoding check
|
|
42
|
+
encoding = sys.stdout.encoding
|
|
43
|
+
if not encoding:
|
|
44
|
+
return False
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
"✓✗".encode(encoding)
|
|
48
|
+
return True
|
|
49
|
+
except UnicodeEncodeError:
|
|
50
|
+
return False
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def get_action_success_string() -> str:
|
|
54
|
+
"""Get the appropriate success symbol based on terminal capabilities.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Unicode tick symbol (✓) if terminal supports UTF-8, otherwise "[ OK ]"
|
|
58
|
+
"""
|
|
59
|
+
return "✓" if _supports_unicode() else "[ OK ]"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_action_failure_string() -> str:
|
|
63
|
+
"""Get the appropriate failure symbol based on terminal capabilities.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Unicode cross symbol (✗) if terminal supports UTF-8, otherwise "[ FAIL ]"
|
|
67
|
+
"""
|
|
68
|
+
return "✗" if _supports_unicode() else "[ FAIL ]"
|
|
69
|
+
|
|
70
|
+
|
|
29
71
|
def _format_task_arguments(arg_specs: list[str | dict]) -> str:
|
|
30
72
|
"""Format task arguments for display in list output.
|
|
31
73
|
|
|
@@ -324,7 +366,7 @@ def _clean_state(tasks_file: Optional[str] = None) -> None:
|
|
|
324
366
|
|
|
325
367
|
if state_path.exists():
|
|
326
368
|
state_path.unlink()
|
|
327
|
-
console.print(f"[green]
|
|
369
|
+
console.print(f"[green]{get_action_success_string()} Removed {state_path}[/green]")
|
|
328
370
|
console.print("All tasks will run fresh on next execution")
|
|
329
371
|
else:
|
|
330
372
|
console.print(f"[yellow]No state file found at {state_path}[/yellow]")
|
|
@@ -410,9 +452,9 @@ def _execute_dynamic_task(args: list[str], force: bool = False, only: bool = Fal
|
|
|
410
452
|
state.save()
|
|
411
453
|
try:
|
|
412
454
|
executor.execute_task(task_name, args_dict, force=force, only=only)
|
|
413
|
-
console.print(f"[green]
|
|
455
|
+
console.print(f"[green]{get_action_success_string()} Task '{task_name}' completed successfully[/green]")
|
|
414
456
|
except Exception as e:
|
|
415
|
-
console.print(f"[red]
|
|
457
|
+
console.print(f"[red]{get_action_failure_string()} Task '{task_name}' failed: {e}[/red]")
|
|
416
458
|
raise typer.Exit(1)
|
|
417
459
|
|
|
418
460
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
tasktree/__init__.py,sha256=MVmdvKb3JdqLlo0x2_TPGMfgFC0HsDnP79HAzGnFnjI,1081
|
|
2
|
-
tasktree/cli.py,sha256=
|
|
2
|
+
tasktree/cli.py,sha256=ywaLXEehOHcMsBioL4RxPQ1vTWIG1V7Hb0TZ1YI2F_g,18820
|
|
3
3
|
tasktree/docker.py,sha256=qvja8G63uAcC73YMVY739egda1_CcBtoqzm0qIJU_Q8,14443
|
|
4
4
|
tasktree/executor.py,sha256=Q7Bks5B88i-IyZDpxGSps9MM3uflz0U3yn4Rtq_uHMM,42266
|
|
5
5
|
tasktree/graph.py,sha256=oXLxX0Ix4zSkVBg8_3x9K7WxSFpg136sp4MF-d2mDEQ,9682
|
|
@@ -9,7 +9,7 @@ tasktree/state.py,sha256=Cktl4D8iDZVd55aO2LqVyPrc-BnljkesxxkcMcdcfOY,3541
|
|
|
9
9
|
tasktree/substitution.py,sha256=M_qcP0NKJATrKcNShSqHJatneuth1RVwTk1ci8-ZuxQ,6473
|
|
10
10
|
tasktree/tasks.py,sha256=2QdQZtJAX2rSGbyXKG1z9VF_siz1DUzdvzCgPkykxtU,173
|
|
11
11
|
tasktree/types.py,sha256=R_YAyO5bMLB6XZnkMRT7VAtlkA_Xx6xu0aIpzQjrBXs,4357
|
|
12
|
-
tasktree-0.0.
|
|
13
|
-
tasktree-0.0.
|
|
14
|
-
tasktree-0.0.
|
|
15
|
-
tasktree-0.0.
|
|
12
|
+
tasktree-0.0.13.dist-info/METADATA,sha256=XEWLN2TsMC-OAlX2fqhQheOEIYIgYXt4X-kk9kzI08U,37234
|
|
13
|
+
tasktree-0.0.13.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
tasktree-0.0.13.dist-info/entry_points.txt,sha256=lQINlvRYnimvteBbnhH84A9clTg8NnpEjCWqWkqg8KE,40
|
|
15
|
+
tasktree-0.0.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|