From 00dd16d7c34f576e76893636dbffc3ea3091e62a Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Sun, 13 Oct 2019 10:13:20 +0200 Subject: [PATCH] [__sensible_editor] List available editors when an incorrect one is provided --- cdist/conf/type/__sensible_editor/explorer/editor_path | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__sensible_editor/explorer/editor_path b/cdist/conf/type/__sensible_editor/explorer/editor_path index b0de2f0a..b6230545 100644 --- a/cdist/conf/type/__sensible_editor/explorer/editor_path +++ b/cdist/conf/type/__sensible_editor/explorer/editor_path @@ -28,7 +28,10 @@ die() { } editor_missing() { die "Editor '$1' is missing on the target system."; } -editor_no_alternative() { die "Editor '$1' is not in the alternatives list of the target system."; } +editor_no_alternative() { + die "Editor '$1' is not in the alternatives list of the target system." \ + "$(test "${editors}" && echo "\nPlease choose one of:\n\n${editors}")" +} case $("${__explorer}/os") @@ -63,7 +66,7 @@ in esac -if $has_alternatives && test "$(echo "${editors}" | wc -l)" -gt 0 +if $has_alternatives && test -n "${editors}" then IFS=' '