Skip to content

Commit

Permalink
Add method to hide ASCII art
Browse files Browse the repository at this point in the history
  • Loading branch information
coelacant1 committed Jan 14, 2025
1 parent 6e0dfc1 commit fed796a
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .check/ShellCheck.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

# Requires Shellcheck: https://github.com/koalaman/shellcheck#user-content-installing

import os
import sys
import subprocess
Expand All @@ -23,7 +25,7 @@ def run_shellcheck(file_path):
Returns stdout, stderr, and the process return code.
"""
result = subprocess.run(
["shellcheck", file_path],
["shellcheck", "-e", "SC1090", file_path],
capture_output=True,
text=True
)
Expand Down Expand Up @@ -74,7 +76,7 @@ def main():

# For each .sh file, either use ShellCheck or fallback checks
for sh_file in sh_files:
print(f"\n=== Checking file: {sh_file} ===")
print(f"=== Checking file: {sh_file} ===")

if shellcheck_installed:
# Run ShellCheck
Expand All @@ -95,8 +97,6 @@ def main():
print("Naive check found potential issues:")
for err in errors:
print(f" - {err}")
else:
print("Naive check: no issues found.")

if __name__ == "__main__":
main()
33 changes: 27 additions & 6 deletions CCPVE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# in the repository executable and finally call CCPVEOffline.sh.
#
# Usage:
# ./CCPVE.sh
# ./CCPVE.sh [-nh]
#
# This script requires 'unzip' and 'wget'. If not installed, it will prompt to install them.
#
Expand All @@ -16,6 +16,23 @@

set -e

apt update || true

SHOW_HEADER="true"

while [[ $# -gt 0 ]]; do
case "$1" in
-nh)
SHOW_HEADER="false"
shift
;;
*)
echo "Error: Unknown argument '$1'"
exit 1
;;
esac
done

# --- Check Dependencies -----------------------------------------------------
if ! command -v unzip &>/dev/null; then
echo "The 'unzip' utility is required to extract the downloaded files but is not installed."
Expand Down Expand Up @@ -77,12 +94,16 @@ else
echo "Warning: MakeScriptsExecutable.sh not found. Skipping."
fi

# --- Call CCPVEOffline.sh --------------------------------------------------
if [ -f "./CCPVEOffline.sh" ]; then
echo "Calling CCPVEOffline.sh..."
bash "./CCPVEOffline.sh"
# --- Call GUI.sh --------------------------------------------------
if [ -f "./GUI.sh" ]; then
echo "Calling GUI.sh..."
if [ "$SHOW_HEADER" != "true" ]; then
bash "./GUI.sh" -nh
else
bash "./GUI.sh"
fi
else
echo "Warning: CCPVEOffline.sh not found. Skipping."
echo "Warning: GUI.sh not found. Skipping."
fi

echo "Done."
2 changes: 0 additions & 2 deletions Cluster/AddNodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ declare -a NODES=()
USE_LINK1=false
declare -a LINK1=()

echo $NODES

while [[ $# -gt 0 ]]; do
case "$1" in
--link1)
Expand Down
40 changes: 35 additions & 5 deletions CCPVEOffline.sh → GUI.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/bin/bash
#
# CCPVEOffline.sh
# GUI.sh
#
# A menu-driven Bash script to navigate and run .sh files in the current folder (and subfolders).
# This version assumes everything is already extracted/unzipped in this directory—no download or unzip needed.
#
# ./GUI.sh [-nh]
#
# Usage:
# 1) cd into the directory containing your .sh files (and this script).
# 2) chmod +x MakeScriptsExecutable.sh
# 3) ./MakeScriptsExecutable.sh
# 4) ./CCPVEOffline.sh
# 4) ./GUI.sh
#
# Author: Coela Can't! (coelacant1)
# Repo: https://github.com/coelacant1/ProxmoxScripts
Expand All @@ -26,6 +28,7 @@ DISPLAY_PREFIX="cc_pve" # How we display the "root" in the UI
HELP_FLAG="--help" # If your scripts support a help flag, we pass this
LAST_SCRIPT="" # The last script run
LAST_OUTPUT="" # Truncated output of the last script
SHOW_HEADER="true"

###############################################################################
# IMPORT UTILITY FUNCTIONS FOR SCRIPTS AND COLOR GRADIENT LIBRARY
Expand All @@ -34,6 +37,23 @@ LAST_OUTPUT="" # Truncated output of the last script
source "./Utilities/Utilities.sh"
source "./Utilities/Colors.sh"

###############################################################################
# HEADER MANAGEMENT
###############################################################################

while [[ $# -gt 0 ]]; do
case "$1" in
-nh)
SHOW_HEADER="false"
shift
;;
*)
echo "Error: Unknown argument '$1'"
exit 1
;;
esac
done

###############################################################################
# ASCII ART HEADER
###############################################################################
Expand Down Expand Up @@ -82,12 +102,23 @@ EOF
)
SMALL_LENGTH=44

BASIC_ASCII=$(cat <<'EOF'
----------------------------------------
 █▀▀ █▀▀ █▀█ █ █ █▀▀ 
 █   █   █▀▀ ▀▄▀ █▀▀ 
 ▀▀▀ ▀▀▀ ▀    ▀  ▀▀▀ 
----------------------------------------
EOF
)

show_ascii_art() {
local width
width=$(tput cols)

# We'll pick a gradient from purple (128,0,128) to cyan (0,255,255)
if ((LARGE_LENGTH <= width)); then
if [ "$SHOW_HEADER" != "true" ]; then
echo "$BASIC_ASCII"
elif ((LARGE_LENGTH <= width)); then
gradient_print "$LARGE_ASCII" 128 0 128 0 255 255 ""
else
gradient_print "$SMALL_ASCII" 128 0 128 0 255 255
Expand Down Expand Up @@ -297,7 +328,7 @@ navigate() {
echo
echo "----------------------------------------"
echo
echo "Type 'h<number>' to show top comments for a script."
echo "Type 'h<number>' to show script comments."
echo "Type 'b' to go up one directory."
echo "Type 'e' to exit."
echo
Expand Down Expand Up @@ -377,6 +408,5 @@ navigate() {
# MAIN
###############################################################################

apt update || true
./MakeScriptsExecutable.sh
navigate "$BASE_DIR"
1 change: 1 addition & 0 deletions Host/-Backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# backup one or all nodes to ssh target
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Or an even shorter single line call:
bash <(curl -L pve.coela.sh)
```


Short single line call with a minimal header:
```bash
bash <(curl -L pve.coela.sh) -nh
```

![Single Line Online Command](.site/SingleLineCommand.png)

### Installation
Expand Down

0 comments on commit fed796a

Please sign in to comment.