[__sensible_editor] Allow to omit the --editor parameter if --state is absent
This commit is contained in:
parent
00dd16d7c3
commit
3bbb7b02d2
4 changed files with 9 additions and 2 deletions
|
@ -33,6 +33,9 @@ editor_no_alternative() {
|
||||||
"$(test "${editors}" && echo "\nPlease choose one of:\n\n${editors}")"
|
"$(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")
|
case $("${__explorer}/os")
|
||||||
in
|
in
|
||||||
|
@ -50,7 +53,9 @@ in
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
case $editor
|
||||||
in
|
in
|
||||||
|
|
|
@ -18,6 +18,8 @@ editor
|
||||||
Name or path of the editor to be selected.
|
Name or path of the editor to be selected.
|
||||||
On systems other than Debian derivatives an absolute path is required.
|
On systems other than Debian derivatives an absolute path is required.
|
||||||
|
|
||||||
|
It is permissible to omit this parameter if --state is absent.
|
||||||
|
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
|
editor
|
||||||
state
|
state
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
editor
|
|
Loading…
Reference in a new issue