Create a function for prompting for profiles
This commit is contained in:
parent
739aa90e88
commit
8bd4cac747
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue