Skip to content

Commit

Permalink
Update some shite
Browse files Browse the repository at this point in the history
  • Loading branch information
ahMADASSadi committed Jan 8, 2025
1 parent a7629f4 commit fed513f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ setup_logging() {
log_file="$log_dir/logs.log"
fi

exec > >(tee >(strip_colors >>"$log_file")) 2>&1
# exec > >(tee >(strip_colors >>"$log_file")) 2>&1

echo -e "$(colorize $COLOR_BLUE "Created at: $(date +"%Y-%m-%d_%H-%M-%S")")"
}
Expand Down
43 changes: 34 additions & 9 deletions menu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from colorama import init as colorama_init
from colorama import Fore,Back
from colorama import Style
import os

colorama_init()
logo = """
█████ █████ █████████ ███████████
░░███ ░░███ ███░░░░░███░█░░░███░░░█
Expand All @@ -10,16 +16,35 @@
"""


def center_text(text: str) -> str:
"""
Centers text for terminal output based on the terminal width.
"""
terminal_width = os.get_terminal_size().columns
lines = text.splitlines()
centered_lines = [
line.center(terminal_width) for line in lines
]
return "\n".join(centered_lines)


def display_menu():
"""Displays a menu of options to the user."""
print(logo)
print("Welcome to the Ubuntu Configuration Tool(UCT)")
print("Please choose an option:")
print("0: See and Update the configuration file")
print("1: Install apps")
print("2: Test ping of the vpn servers")
# Display the logo
print(f"{Back.BLACK}{Fore.CYAN}{center_text(logo)}{Style.RESET_ALL}")

# Display the menu options
menu_text = """
Welcome to the Ubuntu Configuration Tool (UCT)
Please choose an option:
0: See and Update the configuration file
1: Install apps
2: Test ping of the VPN servers
q: Exit
"""
print(f"{Fore.MAGENTA}{center_text(menu_text)}{Style.RESET_ALL}")

print("q: Exit")


def get_user_choice() -> int:
Expand All @@ -31,8 +56,8 @@ def get_user_choice() -> int:
while True:
try:
choice = (input("Enter your choice: "))
if choice in [0, 1, 2, 3]:
return choice
if not choice == "q":
return int(choice)
elif choice == "q":
return choice
else:
Expand Down
31 changes: 31 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "ubuntu-configuration-template"
version = "0.1.0"
description = "A Simple configuration tool for ubuntu"
authors = ["ahMAD ASSadi <ds1380ahmad@gmail.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
termcolor = "^2.5.0"
colorama = "^0.4.6"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit fed513f

Please sign in to comment.