Add documentation for layout generator functions

Added comprehensive docstrings for chassis layout functions:
- generate_10bay_layout(): Sliger CX4712 10-bay chassis
- generate_micro_layout(): Micro SBC (ZimaBoard) layout
- generate_large1_layout(): Rosewill RSV-L4500U 15-bay chassis

Each docstring includes:
- Brief description of what the layout shows
- Arguments with descriptions
- Side effects (build_drive_map call)

Also fixed inconsistent variable quoting in functions.

Fixes: #20

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 11:47:23 -05:00
parent 7450d79f01
commit 3edaafa007

View File

@@ -293,12 +293,23 @@ check_dependencies() {
check_dependencies check_dependencies
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Chassis Type Definitions # Chassis Layout Generator Functions
# These define the physical layout and display formatting for each chassis type # These define the physical layout and display formatting for each chassis type
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# generate_10bay_layout
#
# Generates ASCII art representation of a 10-bay hot-swap chassis (Sliger CX4712).
# Shows storage controllers, M.2 NVMe slot, and 10 front hot-swap bays.
#
# Args:
# $1 - Hostname to display in the layout header
#
# Side effects: Calls build_drive_map() to populate DRIVE_MAP
#------------------------------------------------------------------------------
generate_10bay_layout() { generate_10bay_layout() {
local hostname=$1 local hostname="$1"
build_drive_map build_drive_map
# Fixed width for consistent box drawing (fits device names like "nvme0n1") # Fixed width for consistent box drawing (fits device names like "nvme0n1")
@@ -349,8 +360,19 @@ generate_10bay_layout() {
printf "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n" printf "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n"
} }
#------------------------------------------------------------------------------
# generate_micro_layout
#
# Generates ASCII art representation of a micro SBC (e.g., ZimaBoard).
# Shows storage controllers, onboard eMMC (if present), and 2 SATA ports.
#
# Args:
# $1 - Hostname to display in the layout header
#
# Side effects: Calls build_drive_map() to populate DRIVE_MAP
#------------------------------------------------------------------------------
generate_micro_layout() { generate_micro_layout() {
local hostname=$1 local hostname="$1"
build_drive_map build_drive_map
# Check for eMMC storage # Check for eMMC storage
@@ -384,8 +406,19 @@ generate_micro_layout() {
printf "└─────────────────────────────────────────────────────────────┘\n" printf "└─────────────────────────────────────────────────────────────┘\n"
} }
#------------------------------------------------------------------------------
# generate_large1_layout
#
# Generates ASCII art representation of a large1 chassis (Rosewill RSV-L4500U).
# Shows storage controllers, 2 M.2 NVMe slots, and 15 front bays in 3x5 grid.
#
# Args:
# $1 - Hostname to display in the layout header
#
# Side effects: Calls build_drive_map() to populate DRIVE_MAP
#------------------------------------------------------------------------------
generate_large1_layout() { generate_large1_layout() {
local hostname=$1 local hostname="$1"
build_drive_map build_drive_map
# large1 has 3 stacks of 5 bays at front (15 total) + 2 M.2 slots # large1 has 3 stacks of 5 bays at front (15 total) + 2 M.2 slots