diff --git a/horsch/zsh.nix b/horsch/zsh.nix index 4cc6a3d..407e92b 100644 --- a/horsch/zsh.nix +++ b/horsch/zsh.nix @@ -15,11 +15,35 @@ } function fu-build { - ./kas-container build kas/kas-ttc-image-horsch.yml + local fzf_preview='bat --color always --style plain {}' + + kas_file=$(find kas -maxdepth 1 -type f -name "*image*.yml" \ + | fzf --select-1 --exit-0 --header "Select a image file" --preview ''${fzf_preview}) + + if [ -z ''${kas_file} ]; then + echo "no file selected" + return 1 + fi + + ./kas-container build ''${kas_file} } function fu-build-dev { - ./kas-container build kas/kas-ttc-image-horsch-dev.yml + local fzf_preview='bat --color always --style plain {}' + + local kas_file=kas/kas-ttc-image-horsch-dev.yml + + if [ ! -f ''${kas_file} ]; then + kas_file=$(find kas -maxdepth 1 -type f -name "*image*.yml" \ + | fzf --select-1 --exit-0 --header "Select a image file" --preview ''${fzf_preview}) + fi + + if [ -z ''${kas_file} ]; then + echo "no file selected" + return 1 + fi + + ./kas-container build ''${kas_file} } function fu-reboot {