From 3a942324e2703302b0e39df764bd8ffd4f7c76ec Mon Sep 17 00:00:00 2001
From: Gerald-H <53166232+Gerald-Ha@users.noreply.github.com>
Date: Thu, 28 Nov 2024 14:26:39 +0100
Subject: [PATCH] Add files via upload

---
 ggtree.py    | 31 +++++++++++++++++++++++++++++++
 install.sh   | 31 +++++++++++++++++++++++++++++++
 uninstall.sh | 19 +++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 ggtree.py
 create mode 100644 install.sh
 create mode 100644 uninstall.sh

diff --git a/ggtree.py b/ggtree.py
new file mode 100644
index 0000000..c42625f
--- /dev/null
+++ b/ggtree.py
@@ -0,0 +1,31 @@
+import os
+
+# Metadata
+version = "1.0.4"
+author = "Gerald Hasani"
+name = "GGTree"
+email = "contact@gerald-hasani.com"
+github = "https://github.com/Gerald-Ha"
+
+def print_tree(start_path=".", prefix=""):
+    """
+    Print the directory tree structure starting from `start_path`.
+
+    :param start_path: Root directory to start building the tree.
+    :param prefix: Indentation for the current level of the tree.
+    """
+    entries = sorted(os.listdir(start_path))
+    entries_count = len(entries)
+
+    for index, entry in enumerate(entries):
+        path = os.path.join(start_path, entry)
+        connector = "└── " if index == entries_count - 1 else "├── "
+        print(prefix + connector + entry)
+
+        if os.path.isdir(path):
+            extension = "    " if index == entries_count - 1 else "│   "
+            print_tree(path, prefix + extension)
+
+if __name__ == "__main__":
+    print("Directory tree for:", os.getcwd())
+    print_tree()
diff --git a/install.sh b/install.sh
new file mode 100644
index 0000000..5ae11cd
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# Install script for ggtree
+
+# Define the target directory for the binary
+BIN_DIR="/usr/local/bin"
+SCRIPT_NAME="ggtree"
+
+# Copy the Python script to /usr/local/bin
+if [[ $EUID -ne 0 ]]; then
+  echo "This script must be run as root" >&2
+  exit 1
+fi
+
+SCRIPT_PATH="$(pwd)/ggtree.py"
+TARGET_PATH="$BIN_DIR/$SCRIPT_NAME"
+
+if [[ ! -f "$SCRIPT_PATH" ]]; then
+  echo "ggtree.py not found in the current directory. Aborting installation." >&2
+  exit 1
+fi
+
+# Create a wrapper to call the Python script
+cat << WRAPPER > "$TARGET_PATH"
+#!/bin/bash
+python3 "$SCRIPT_PATH"
+WRAPPER
+
+# Make the wrapper executable
+chmod +x "$TARGET_PATH"
+
+echo "ggtree installed successfully. You can now use the command 'ggtree' from anywhere."
diff --git a/uninstall.sh b/uninstall.sh
new file mode 100644
index 0000000..b053ad8
--- /dev/null
+++ b/uninstall.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Uninstall script for ggtree
+
+# Define the target directory for the binary
+BIN_DIR="/usr/local/bin"
+SCRIPT_NAME="ggtree"
+TARGET_PATH="$BIN_DIR/$SCRIPT_NAME"
+
+if [[ $EUID -ne 0 ]]; then
+  echo "This script must be run as root" >&2
+  exit 1
+fi
+
+if [[ -f "$TARGET_PATH" ]]; then
+  rm "$TARGET_PATH"
+  echo "ggtree has been uninstalled."
+else
+  echo "ggtree is not installed."
+fi