mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-25 08:43:36 +05:00
feat(BackupManager): implement simple backup manager
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
25
kiauh/utils/common.py
Normal file
25
kiauh/utils/common.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# ======================================================================= #
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
# ======================================================================= #
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Dict, Literal
|
||||
|
||||
|
||||
def get_current_date() -> Dict[Literal["date", "time"], str]:
|
||||
"""
|
||||
Get the current date |
|
||||
:return: a Dict holding a date and time key:value pair
|
||||
"""
|
||||
now: datetime = datetime.today()
|
||||
date: str = now.strftime("%Y-%m-%d")
|
||||
time: str = now.strftime("%H-%M-%S")
|
||||
|
||||
return {"date": date, "time": time}
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
import os
|
||||
import pwd
|
||||
from pathlib import Path
|
||||
|
||||
# text colors and formats
|
||||
COLOR_MAGENTA = "\033[35m" # magenta
|
||||
@@ -19,6 +20,8 @@ COLOR_YELLOW = "\033[93m" # bright yellow
|
||||
COLOR_RED = "\033[91m" # bright red
|
||||
COLOR_CYAN = "\033[96m" # bright cyan
|
||||
RESET_FORMAT = "\033[0m" # reset format
|
||||
# kiauh
|
||||
KIAUH_BACKUP_DIR = f"{Path.home()}/kiauh-backups"
|
||||
# current user
|
||||
CURRENT_USER = pwd.getpwuid(os.getuid())[0]
|
||||
SYSTEMD = "/etc/systemd/system"
|
||||
|
||||
Reference in New Issue
Block a user