From 3edaafa007898b6fb368651b28644d2d49bcf24b Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 5 Feb 2026 11:47:23 -0500 Subject: [PATCH] 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: https://code.lotusguild.org/LotusGuild/driveAtlas/issues/20 Co-Authored-By: Claude Opus 4.5 --- driveAtlas.sh | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/driveAtlas.sh b/driveAtlas.sh index ff6f7e6..60c564d 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -293,12 +293,23 @@ check_dependencies() { check_dependencies #------------------------------------------------------------------------------ -# Chassis Type Definitions +# Chassis Layout Generator Functions # 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() { - local hostname=$1 + local hostname="$1" build_drive_map # Fixed width for consistent box drawing (fits device names like "nvme0n1") @@ -349,8 +360,19 @@ generate_10bay_layout() { 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() { - local hostname=$1 + local hostname="$1" build_drive_map # Check for eMMC storage @@ -384,8 +406,19 @@ generate_micro_layout() { 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() { - local hostname=$1 + local hostname="$1" build_drive_map # large1 has 3 stacks of 5 bays at front (15 total) + 2 M.2 slots