Add 'zdtt github' command to install.sh for opening the ZDTT GitHub repository
- Implemented a new command in install.sh that opens the ZDTT GitHub repository in the user's default web browser based on the operating system. - Updated the help text to include the new command, improving user access to the repository. - Removed the previous 'github' command from terminal.py to streamline functionality and avoid redundancy.
This commit is contained in:
24
install.sh
24
install.sh
@@ -582,6 +582,29 @@ case "$1" in
|
|||||||
echo " • Plugin system"
|
echo " • Plugin system"
|
||||||
echo " • Native command support"
|
echo " • Native command support"
|
||||||
;;
|
;;
|
||||||
|
github)
|
||||||
|
GITHUB_URL="https://github.com/ZaneThePython/ZDTT"
|
||||||
|
echo "Opening ZDTT GitHub repository..."
|
||||||
|
|
||||||
|
# Detect platform and use appropriate command to open URL
|
||||||
|
if [[ "$(uname)" == "Darwin" ]]; then
|
||||||
|
# macOS
|
||||||
|
open "$GITHUB_URL"
|
||||||
|
elif command -v xdg-open &> /dev/null; then
|
||||||
|
# Linux (most distributions)
|
||||||
|
xdg-open "$GITHUB_URL"
|
||||||
|
elif command -v x-www-browser &> /dev/null; then
|
||||||
|
# Linux (Debian/Ubuntu fallback)
|
||||||
|
x-www-browser "$GITHUB_URL"
|
||||||
|
elif command -v gnome-open &> /dev/null; then
|
||||||
|
# Linux (GNOME fallback)
|
||||||
|
gnome-open "$GITHUB_URL"
|
||||||
|
else
|
||||||
|
# Fallback: print URL and let user open manually
|
||||||
|
echo "Please open this URL in your browser:"
|
||||||
|
echo "$GITHUB_URL"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ZDTT Terminal"
|
echo "ZDTT Terminal"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -590,6 +613,7 @@ case "$1" in
|
|||||||
echo " zdtt update - Check for and install updates"
|
echo " zdtt update - Check for and install updates"
|
||||||
echo " zdtt installer - Run installer (for updates/reinstall)"
|
echo " zdtt installer - Run installer (for updates/reinstall)"
|
||||||
echo " zdtt version - Display version information"
|
echo " zdtt version - Display version information"
|
||||||
|
echo " zdtt github - Open ZDTT GitHub repository"
|
||||||
echo " zdtt uninstall - Uninstall ZDTT Terminal"
|
echo " zdtt uninstall - Uninstall ZDTT Terminal"
|
||||||
echo ""
|
echo ""
|
||||||
;;
|
;;
|
||||||
|
|||||||
16
terminal.py
16
terminal.py
@@ -21,7 +21,6 @@ import ast
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import webbrowser
|
|
||||||
import time as time_module
|
import time as time_module
|
||||||
|
|
||||||
|
|
||||||
@@ -433,7 +432,6 @@ class ZDTTTerminal:
|
|||||||
'time': self.cmd_time,
|
'time': self.cmd_time,
|
||||||
'statusbar': self.cmd_statusbar,
|
'statusbar': self.cmd_statusbar,
|
||||||
'update': self.cmd_update,
|
'update': self.cmd_update,
|
||||||
'github': self.cmd_github,
|
|
||||||
# System commands
|
# System commands
|
||||||
'ls': self.cmd_ls,
|
'ls': self.cmd_ls,
|
||||||
'pwd': self.cmd_pwd,
|
'pwd': self.cmd_pwd,
|
||||||
@@ -1272,7 +1270,6 @@ ZDTT Terminal v{self.version}
|
|||||||
print(f" {self.COLOR_BRIGHT_GREEN}time{self.COLOR_RESET} [options] - Display date/time (MM/DD/YY 12h default)")
|
print(f" {self.COLOR_BRIGHT_GREEN}time{self.COLOR_RESET} [options] - Display date/time (MM/DD/YY 12h default)")
|
||||||
print(f" {self.COLOR_BRIGHT_GREEN}statusbar{self.COLOR_RESET} color <name> - Change status bar highlight color")
|
print(f" {self.COLOR_BRIGHT_GREEN}statusbar{self.COLOR_RESET} color <name> - Change status bar highlight color")
|
||||||
print(f" {self.COLOR_BRIGHT_GREEN}update{self.COLOR_RESET} - Run the ZDTT updater helper")
|
print(f" {self.COLOR_BRIGHT_GREEN}update{self.COLOR_RESET} - Run the ZDTT updater helper")
|
||||||
print(f" {self.COLOR_BRIGHT_GREEN}github{self.COLOR_RESET} - Open ZDTT GitHub repository")
|
|
||||||
print(f" {self.COLOR_BRIGHT_GREEN}exit{self.COLOR_RESET} - Exit ZDTT (return to shell)")
|
print(f" {self.COLOR_BRIGHT_GREEN}exit{self.COLOR_RESET} - Exit ZDTT (return to shell)")
|
||||||
print(f" {self.COLOR_BRIGHT_GREEN}quit{self.COLOR_RESET} - Quit and close terminal window")
|
print(f" {self.COLOR_BRIGHT_GREEN}quit{self.COLOR_RESET} - Quit and close terminal window")
|
||||||
print()
|
print()
|
||||||
@@ -2055,19 +2052,6 @@ ZDTT Terminal v{self.version}
|
|||||||
elif self.is_arch:
|
elif self.is_arch:
|
||||||
print("Try installing with: sudo pacman -S python-pip")
|
print("Try installing with: sudo pacman -S python-pip")
|
||||||
|
|
||||||
def cmd_github(self, args):
|
|
||||||
"""Open the ZDTT GitHub repository in the default browser."""
|
|
||||||
github_url = "https://github.com/ZaneThePython/ZDTT"
|
|
||||||
print(f"{self.COLOR_BRIGHT_CYAN}Opening ZDTT GitHub repository...{self.COLOR_RESET}")
|
|
||||||
print(f"{self.COLOR_DIM}URL: {github_url}{self.COLOR_RESET}")
|
|
||||||
print()
|
|
||||||
try:
|
|
||||||
webbrowser.open(github_url)
|
|
||||||
print(f"{self.COLOR_BRIGHT_GREEN}✓{self.COLOR_RESET} GitHub repository opened in your default browser")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"{self.COLOR_ERROR}Failed to open browser: {e}{self.COLOR_RESET}")
|
|
||||||
print(f"{self.COLOR_DIM}Please visit: {github_url}{self.COLOR_RESET}")
|
|
||||||
|
|
||||||
def cmd_update(self, args):
|
def cmd_update(self, args):
|
||||||
"""Trigger the external updater shipping with ZDTT."""
|
"""Trigger the external updater shipping with ZDTT."""
|
||||||
zdtt_wrapper = shutil.which('zdtt')
|
zdtt_wrapper = shutil.which('zdtt')
|
||||||
|
|||||||
Reference in New Issue
Block a user