[__sensible_editor] Allow to omit the --editor parameter if --state is absent

This commit is contained in:
Dennis Camera 2019-10-13 10:14:05 +02:00
parent 00dd16d7c3
commit 3bbb7b02d2
4 changed files with 9 additions and 2 deletions

View file

@ -33,6 +33,9 @@ editor_no_alternative() {
"$(test "${editors}" && echo "\nPlease choose one of:\n\n${editors}")"
}
# No need to check for the path if the file is supposed to be removed.
test "$(cat "${__object}/parameter/state")" != 'absent' || exit 0
case $("${__explorer}/os")
in
@ -50,7 +53,9 @@ in
;;
esac
editor=$(cat "${__object}/parameter/editor")
# Read --editor parameter and check its value since it is "optional"
editor=$(cat "${__object}/parameter/editor" 2>/dev/null) || true
test -n "${editor}" || die 'Please provide an --editor to configure.'
case $editor
in

View file

@ -18,6 +18,8 @@ editor
Name or path of the editor to be selected.
On systems other than Debian derivatives an absolute path is required.
It is permissible to omit this parameter if --state is absent.
OPTIONAL PARAMETERS
-------------------

View file

@ -1 +1,2 @@
editor
state

View file

@ -1 +0,0 @@
editor