basecamp_omarchy/bin/omarchy-drive-select
2026-01-05 10:17:32 +01:00

19 lines
544 B
Bash
Executable File

#!/bin/bash
# Select a drive from a list with info that includes space and brand. Used by omarchy-drive-set-password.
if (($# == 0)); then
drives=$(lsblk -dpno NAME | grep -E '/dev/(sd|hd|vd|nvme|mmcblk|xv)')
else
drives="$@"
fi
drives_with_info=""
while IFS= read -r drive; do
[[ -n "$drive" ]] || continue
drives_with_info+="$(omarchy-drive-info "$drive")"$'\n'
done <<<"$drives"
selected_drive="$(printf "%s" "$drives_with_info" | gum choose --header "Select drive")" || exit 1
printf "%s\n" "$selected_drive" | awk '{print $1}'