diff options
| author | Olivier Perret <Olivier.Perret@mailbox.org> | 2019-10-08 18:06:54 +0200 |
|---|---|---|
| committer | Olivier Perret <Olivier.Perret@mailbox.org> | 2019-10-08 18:06:54 +0200 |
| commit | fac05f3ea0d633d6197a60a6102dcdbbce3718d5 (patch) | |
| tree | a48c8591f5cde53ba0d994f3c1fbc6e324cbaae6 /rc/filetype/lua.kak | |
| parent | 2f1be14b5f4d3668df14f56239978e7e00102806 (diff) | |
[rc] Use 'fail' when the alternative file cannot be found
This makes it possible to implement a fallback strategy using 'try .. catch',
for cases where the alternative file is not stored in a subdirectory
Diffstat (limited to 'rc/filetype/lua.kak')
| -rw-r--r-- | rc/filetype/lua.kak | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak index ed97cbb8..64a5a5a2 100644 --- a/rc/filetype/lua.kak +++ b/rc/filetype/lua.kak @@ -54,7 +54,7 @@ define-command lua-alternative-file -docstring 'Jump to the alternate file (impl case $kak_buffile in *spec/*_spec.lua) altfile=$(eval printf %s\\n $(printf %s\\n $kak_buffile | sed s+spec/+'*'/+';'s/_spec//)) - [ ! -f $altfile ] && echo "echo -markup '{Error}implementation file not found'" && exit + [ ! -f $altfile ] && echo "fail 'implementation file not found'" && exit ;; *.lua) path=$kak_buffile @@ -66,10 +66,10 @@ define-command lua-alternative-file -docstring 'Jump to the alternate file (impl break fi done - [ ! -d $altdir ] && echo "echo -markup '{Error}spec/ not found'" && exit + [ ! -d $altdir ] && echo "fail 'spec/ not found'" && exit ;; *) - echo "echo -markup '{Error}alternative file not found'" && exit + echo "fail 'alternative file not found'" && exit ;; esac printf %s\\n "edit $altfile" |
