From 2759080411bd6587ee249468ddb93b9ef1baae42 Mon Sep 17 00:00:00 2001 From: laniakea64 Date: Thu, 25 Jan 2024 16:05:14 -0500 Subject: [PATCH] preview: allow previewing test cases by name --- justfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index 0455c52..8717845 100644 --- a/justfile +++ b/justfile @@ -2,6 +2,7 @@ set fallback justq := quote(just_executable()) + ' -f ' + quote(justfile()) +test_cases := justfile_directory() / 'tests/cases' @_default: {{justq}} --list @@ -12,20 +13,20 @@ synpreview_rtp := '-c ' + quote("let &runtimepath=\"" + justfile_directory() + " [no-cd] preview JUSTFILE='': vim {{synpreview_rtp}} \ - {{if JUSTFILE == '' { '-c "set filetype=just"' } else { quote(JUSTFILE) } }} + {{if JUSTFILE == '' { '-c "set filetype=just"' } else if path_exists(test_cases / JUSTFILE + '.just') == 'true' { quote(test_cases / JUSTFILE + '.just') } else { quote(JUSTFILE) } }} # preview JUSTFILE in GVim with syntax file from this repository [no-cd] gpreview JUSTFILE='': gvim -f {{synpreview_rtp}} \ - {{if JUSTFILE == '' { '-c "set filetype=just"' } else { quote(JUSTFILE) } }} + {{if JUSTFILE == '' { '-c "set filetype=just"' } else if path_exists(test_cases / JUSTFILE + '.just') == 'true' { quote(test_cases / JUSTFILE + '.just') } else { quote(JUSTFILE) } }} # preview JUSTFILE in Neovim with syntax file from this repository [no-cd] npreview JUSTFILE='': nvim {{synpreview_rtp}} \ -c 'syntax on' \ - {{if JUSTFILE == '' { '-c "set filetype=just"' } else { quote(JUSTFILE) } }} + {{if JUSTFILE == '' { '-c "set filetype=just"' } else if path_exists(test_cases / JUSTFILE + '.just') == 'true' { quote(test_cases / JUSTFILE + '.just') } else { quote(JUSTFILE) } }} update-last-changed *force: