Dotfiles update 2025-12-25 10:29
This commit is contained in:
@@ -73,103 +73,6 @@ typeset -g DF_HINT="$DF_DIM"
|
|||||||
typeset -g DF_ACCENT="$DF_BLUE"
|
typeset -g DF_ACCENT="$DF_BLUE"
|
||||||
typeset -g DF_MUTED="$DF_GREY"
|
typeset -g DF_MUTED="$DF_GREY"
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Common Print Functions
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
# Print a step/section header
|
|
||||||
df_print_step() {
|
|
||||||
echo -e "${DF_GREEN}==>${DF_NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print success message
|
|
||||||
df_print_success() {
|
|
||||||
echo -e "${DF_GREEN}✓${DF_NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print error message (to stderr)
|
|
||||||
df_print_error() {
|
|
||||||
echo -e "${DF_RED}✗${DF_NC} $1" >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print warning message
|
|
||||||
df_print_warning() {
|
|
||||||
echo -e "${DF_YELLOW}⚠${DF_NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print info message
|
|
||||||
df_print_info() {
|
|
||||||
echo -e "${DF_CYAN}ℹ${DF_NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print a section divider
|
|
||||||
df_print_section() {
|
|
||||||
echo ""
|
|
||||||
echo -e "${DF_BLUE}▶${DF_NC} $1"
|
|
||||||
echo -e "${DF_CYAN}─────────────────────────────────────────────────────────────${DF_NC}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# MOTD-Style Header/Function Header
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
# Prints a standardized header box for scripts
|
|
||||||
# Usage: df_print_header "script-name"
|
|
||||||
# Usage: df_print_func_name "func-name"
|
|
||||||
|
|
||||||
df_print_func_name() {
|
|
||||||
local func_name="${1:-func}"
|
|
||||||
local datetime=$(date '+%a %b %d %H:%M')
|
|
||||||
local width=66
|
|
||||||
|
|
||||||
# Build horizontal line
|
|
||||||
local hline=""
|
|
||||||
for ((i=0; i<width; i++)); do hline+="═"; done
|
|
||||||
local inner=$((width - 2))
|
|
||||||
|
|
||||||
# Header content
|
|
||||||
local h_left="${func_name}"
|
|
||||||
local h_right="${datetime}"
|
|
||||||
local h_pad=$((inner - ${#h_left} - ${#h_right}))
|
|
||||||
local h_spaces=""
|
|
||||||
for ((i=0; i<h_pad; i++)); do h_spaces+=" "; done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo -e "${DF_GREY}╒${hline}╕${DF_NC}"
|
|
||||||
echo -e "${DF_GREY}│${DF_NC} ${DF_BOLD}${DF_LIGHT_BLUE}${h_left}${DF_NC}${h_spaces}${DF_NC}${DF_BOLD}${h_right}${DF_NC} ${DF_GREY}│${DF_NC}"
|
|
||||||
echo -e "${DF_GREY}╘${hline}╛${DF_NC}"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
df_print_header() {
|
|
||||||
local script_name="${1:-script}"
|
|
||||||
local user="${USER:-root}"
|
|
||||||
local hostname="${HOST:-${HOSTNAME:-$(hostname -s 2>/dev/null)}}"
|
|
||||||
local datetime=$(date '+%a %b %d %H:%M')
|
|
||||||
local width=66
|
|
||||||
|
|
||||||
# Build horizontal line
|
|
||||||
local hline=""
|
|
||||||
for ((i=0; i<width; i++)); do hline+="═"; done
|
|
||||||
local inner=$((width - 2))
|
|
||||||
|
|
||||||
# Header content
|
|
||||||
local h_left="✦ ${user}@${hostname}"
|
|
||||||
local h_center="${script_name}"
|
|
||||||
local h_right="${datetime}"
|
|
||||||
local h_pad=$(((inner - ${#h_left} - ${#h_center} - ${#h_right}) / 2))
|
|
||||||
local h_spaces=""
|
|
||||||
for ((i=0; i<h_pad; i++)); do h_spaces+=" "; done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo -e "${DF_GREY}╒${hline}╕${DF_NC}"
|
|
||||||
echo -e "${DF_GREY}│${DF_NC} ${DF_BOLD}${DF_LIGHT_BLUE}${h_left}${DF_NC}${h_spaces}${DF_LIGHT_GREEN}${h_center}${h_spaces}${DF_NC}${DF_BOLD}${h_right}${DF_NC} ${DF_GREY}│${DF_NC}"
|
|
||||||
echo -e "${DF_GREY}╘${hline}╛${DF_NC}"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Bash Compatibility
|
# Bash Compatibility
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|||||||
@@ -12,6 +12,101 @@
|
|||||||
source "${0:A:h}/colors.zsh" 2>/dev/null || \
|
source "${0:A:h}/colors.zsh" 2>/dev/null || \
|
||||||
source "$HOME/.dotfiles/zsh/lib/colors.zsh" 2>/dev/null
|
source "$HOME/.dotfiles/zsh/lib/colors.zsh" 2>/dev/null
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Common Print Functions
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Print a step/section header
|
||||||
|
df_print_step() {
|
||||||
|
echo -e "${DF_GREEN}==>${DF_NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print success message
|
||||||
|
df_print_success() {
|
||||||
|
echo -e "${DF_GREEN}✓${DF_NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print error message (to stderr)
|
||||||
|
df_print_error() {
|
||||||
|
echo -e "${DF_RED}✗${DF_NC} $1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print warning message
|
||||||
|
df_print_warning() {
|
||||||
|
echo -e "${DF_YELLOW}⚠${DF_NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print info message
|
||||||
|
df_print_info() {
|
||||||
|
echo -e "${DF_CYAN}ℹ${DF_NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print a section divider
|
||||||
|
df_print_section() {
|
||||||
|
echo ""
|
||||||
|
echo -e "${DF_BLUE}▶${DF_NC} $1"
|
||||||
|
echo -e "${DF_CYAN}─────────────────────────────────────────────────────────────${DF_NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# MOTD-Style Header/Function Header
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Prints a standardized header box for scripts
|
||||||
|
# Usage: df_print_header "script-name"
|
||||||
|
# Usage: df_print_func_name "func-name"
|
||||||
|
|
||||||
|
df_print_func_name() {
|
||||||
|
local func_name="${1:-func}"
|
||||||
|
local datetime=$(date '+%a %b %d %H:%M')
|
||||||
|
local width=66
|
||||||
|
|
||||||
|
# Build horizontal line
|
||||||
|
local hline=""
|
||||||
|
for ((i=0; i<width; i++)); do hline+="═"; done
|
||||||
|
local inner=$((width - 2))
|
||||||
|
|
||||||
|
# Header content
|
||||||
|
local h_left="${func_name}"
|
||||||
|
local h_right="${datetime}"
|
||||||
|
local h_pad=$((inner - ${#h_left} - ${#h_right}))
|
||||||
|
local h_spaces=""
|
||||||
|
for ((i=0; i<h_pad; i++)); do h_spaces+=" "; done
|
||||||
|
echo ""
|
||||||
|
echo -e "${DF_GREY}╒${hline}╕${DF_NC}"
|
||||||
|
echo -e "${DF_GREY}│${DF_NC} ${DF_BOLD}${DF_LIGHT_BLUE}${h_left}${DF_NC}${h_spaces}${DF_NC}${DF_BOLD}${h_right}${DF_NC} ${DF_GREY}│${DF_NC}"
|
||||||
|
echo -e "${DF_GREY}╘${hline}╛${DF_NC}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
df_print_header() {
|
||||||
|
local script_name="${1:-script}"
|
||||||
|
local user="${USER:-root}"
|
||||||
|
local hostname="${HOST:-${HOSTNAME:-$(hostname -s 2>/dev/null)}}"
|
||||||
|
local datetime=$(date '+%a %b %d %H:%M')
|
||||||
|
local width=66
|
||||||
|
|
||||||
|
# Build horizontal line
|
||||||
|
local hline=""
|
||||||
|
for ((i=0; i<width; i++)); do hline+="═"; done
|
||||||
|
local inner=$((width - 2))
|
||||||
|
|
||||||
|
# Header content
|
||||||
|
local h_left="✦ ${user}@${hostname}"
|
||||||
|
local h_center="${script_name}"
|
||||||
|
local h_right="${datetime}"
|
||||||
|
local h_pad=$(((inner - ${#h_left} - ${#h_center} - ${#h_right}) / 2))
|
||||||
|
local h_spaces=""
|
||||||
|
for ((i=0; i<h_pad; i++)); do h_spaces+=" "; done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${DF_GREY}╒${hline}╕${DF_NC}"
|
||||||
|
echo -e "${DF_GREY}│${DF_NC} ${DF_BOLD}${DF_LIGHT_BLUE}${h_left}${DF_NC}${h_spaces}${DF_LIGHT_GREEN}${h_center}${h_spaces}${DF_NC}${DF_BOLD}${h_right}${DF_NC} ${DF_GREY}│${DF_NC}"
|
||||||
|
echo -e "${DF_GREY}╘${hline}╛${DF_NC}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Output Formatting Functions
|
# Output Formatting Functions
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user