diff --git a/install.sh b/install.sh index 51971a6..42d06e1 100644 --- a/install.sh +++ b/install.sh @@ -114,10 +114,11 @@ mkdir -p "$BIN_DIR" echo "Installing ZDTT Terminal..." -# Copy the terminal.py and install.sh to the installation directory +# Copy the terminal.py, install.sh, and version.txt to the installation directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cp "$SCRIPT_DIR/terminal.py" "$INSTALL_DIR/terminal.py" cp "$SCRIPT_DIR/install.sh" "$INSTALL_DIR/install.sh" +cp "$SCRIPT_DIR/version.txt" "$INSTALL_DIR/version.txt" chmod +x "$INSTALL_DIR/terminal.py" chmod +x "$INSTALL_DIR/install.sh" @@ -155,7 +156,12 @@ case "$1" in echo "ZDTT Terminal has been uninstalled." ;; version) - echo "ZDTT Terminal v0.0.1.alpha" + if [ -f "$ZDTT_DIR/version.txt" ]; then + VERSION=$(cat "$ZDTT_DIR/version.txt") + echo "ZDTT Terminal v$VERSION" + else + echo "ZDTT Terminal v0.0.1.a" + fi echo "" echo "Features:" echo " • Command history (↑/↓ navigation)" diff --git a/terminal.py b/terminal.py index f620626..00c2f52 100644 --- a/terminal.py +++ b/terminal.py @@ -46,6 +46,9 @@ class ZDTTTerminal: self.history_file = os.path.expanduser("~/.zdtt_history") self.plugin_dir = os.path.expanduser("~/.zdtt/plugins") + # Read version from version.txt + self.version = self.read_version() + # ANSI color codes self.COLOR_RESET = '\033[0m' self.COLOR_GREEN = '\033[92m' @@ -86,9 +89,27 @@ class ZDTTTerminal: # Load plugins self.load_plugins() + def read_version(self): + """Read version from version.txt file""" + # Try multiple locations for version.txt + version_paths = [ + os.path.join(os.path.dirname(__file__), 'version.txt'), # Same dir as script + os.path.expanduser("~/.local/share/zdtt/version.txt"), # Installed location + ] + + for path in version_paths: + try: + with open(path, 'r') as f: + return f.read().strip() + except FileNotFoundError: + continue + + # Fallback version if file not found + return "0.0.1.a" + def display_banner(self): """Display the ZDTT ASCII art banner""" - banner = """ + banner = f""" ░█████████ ░███████ ░██████████░██████████ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ @@ -98,7 +119,7 @@ class ZDTTTerminal: ░█████████ ░███████ ░██ ░██ -ZDTT Terminal v0.0.1.alpha +ZDTT Terminal v{self.version} """ print(banner) @@ -262,7 +283,7 @@ ZDTT Terminal v0.0.1.alpha def cmd_about(self, args): """Display information about ZDTT Terminal""" - print("\nZDTT Terminal v0.0.1.alpha") + print(f"\nZDTT Terminal v{self.version}") print("A custom terminal interface for Debian-based Linux") print() print("Features:") diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..c268d65 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.0.1.a