mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
feat: add an optional fun animation on the bottom
This commit is contained in:
parent
9fc3f3dcd6
commit
df6b695dd6
8 changed files with 1545 additions and 777 deletions
44
plugins/taskman/task_cli.py
Normal file
44
plugins/taskman/task_cli.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Terminal Task Manager CLI - Command-line interface for task management
|
||||
|
||||
This module provides command-line access to the task management system.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Dict, Optional
|
||||
|
||||
def humanize_time_delta(created_at: str) -> str:
|
||||
"""Convert ISO timestamp to human-readable time delta using local timezone"""
|
||||
try:
|
||||
created = datetime.fromisoformat(created_at.replace('Z', '+00:00'))
|
||||
if created.tzinfo is None:
|
||||
# If no timezone info, assume it's local time
|
||||
created = created.replace(tzinfo=timezone.utc).astimezone()
|
||||
else:
|
||||
# Convert to local timezone
|
||||
created = created.astimezone()
|
||||
|
||||
now = datetime.now().astimezone()
|
||||
delta = now - created
|
||||
|
||||
days = delta.days
|
||||
hours = delta.seconds // 3600
|
||||
minutes = (delta.seconds % 3600) // 60
|
||||
|
||||
if days > 0:
|
||||
return f"{days}d"
|
||||
elif hours > 0:
|
||||
return f"{hours}h"
|
||||
elif minutes > 0:
|
||||
return f"{minutes}m"
|
||||
else:
|
||||
return "now"
|
||||
except:
|
||||
return "?"
|
||||
|
||||
# ... existing code ...
|
||||
Loading…
Add table
Add a link
Reference in a new issue