Skip to content

Commit

Permalink
preview: allow previewing test cases by name
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Jan 25, 2024
1 parent 96aa5a4 commit 2759080
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set fallback

justq := quote(just_executable()) + ' -f ' + quote(justfile())
test_cases := justfile_directory() / 'tests/cases'

@_default:
{{justq}} --list
Expand All @@ -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:
Expand Down

0 comments on commit 2759080

Please sign in to comment.