Create a function for prompting for profiles

This commit is contained in:
Manuel Thalmann 2024-09-30 14:41:02 +02:00
parent 739aa90e88
commit 8bd4cac747

View file

@ -3,6 +3,25 @@ function isConfigured -S
set -q CONFIG_NAME
end
function selectProfile -S -a result
source "$(status dirname)/../../../lib/modules/partition/select.fish"
set -l file (mktemp)
set -l header "NAME"
set -l profiles
getProfiles | jq ".[]" --raw-output0 | string split0 | while read profile
set -a profiles "$profile"
end
select "$header" "$file" \
"Please choose a profile" \
"No profiles specified" \
"$(string collect $profiles)"
set -g "$result" (cat "$file")
rm "$file"
end
function getProfiles -S
source "$(status dirname)/eval-flake.fish";
evalFlake "" "" --apply "builtins.attrNames" --json