Files
omarchy/bin/omarchy-drive-select
2025-09-09 14:10:42 +02:00

19 lines
507 B
Bash
Executable File

#!/bin/bash
# Select a drive from a list with info that includes space and brand
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}'