Skip to content

Commit

Permalink
Add [extension] and [script] attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Jul 18, 2024
1 parent 5dd2224 commit 05f05b6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/just.vim
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ syn region justRecipeAttributes
\ contains=justRecipeAttr,justRecipeAttrSep,justRecipeAttrArgs,justRecipeAttrArgError,justRecipeAttrValueShort

syn keyword justRecipeAttr
\ confirm doc group linux macos no-cd no-exit-message no-quiet positional-arguments private unix windows
\ confirm doc extension group linux macos no-cd no-exit-message no-quiet positional-arguments private script unix windows
\ contained
syn match justRecipeAttrSep ',' contained
syn match justRecipeAttrValueShort '\v:%(\_s|\\\n)*' transparent contained
Expand Down
6 changes: 6 additions & 0 deletions tests/cases/recipes-with-extras.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,9 @@
<span class="Type">[doc</span><span class="Operator">:</span> <span class="String">x"echo value of </span><span class="Special">$$</span><span class="String">HOME: </span><span class="PreProc">$HOME</span><span class="String">"</span><span class="Type">]</span>
<span class="Function">attr-colon-shell-expanded-string</span><span class="Operator">:</span>
<span class="Number">&Tab;echo </span><span class="String">"$HOME"</span>

<span class="Type">[extension</span><span class="Operator">:</span> <span class="String">'.py'</span><span class="Type">]</span>
<span class="Function">ext</span><span class="Operator">:</span>
<span class="SpecialComment">&Tab;#!/usr/bin/env python3</span>
<span class="Number">&Tab;import sys</span>
<span class="Number">&Tab;print(sys.argv)</span>
6 changes: 6 additions & 0 deletions tests/cases/recipes-with-extras.just
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,9 @@ attr-colon3:
[doc: x"echo value of $$HOME: $HOME"]
attr-colon-shell-expanded-string:
echo "$HOME"

[extension: '.py']
ext:
#!/usr/bin/env python3
import sys
print(sys.argv)
9 changes: 9 additions & 0 deletions tests/cases/script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<span class="Type">[script</span><span class="Operator">:</span> <span class="String">'python3'</span><span class="Type">]</span>
<span class="Function">python_info</span><span class="Operator">:</span>
<span class="Number">&Tab;import platform</span>
<span class="Number">&Tab;print(platform.python_implementation(), platform.python_version())</span>

<span class="Type">[script(</span><span class="String">'just'</span>, <span class="String">'-d'</span>, <span class="String">x'</span><span class="PreProc">${PWD</span><span class="Operator">:-</span><span class="Character">.</span><span class="PreProc">}</span><span class="String">/'</span>, <span class="String">'-f'</span><span class="Type">)]</span>
<span class="Function">nested_justfile</span><span class="Operator">:</span>
<span class="Number">&Tab;foo:</span>
<span class="Number">&Tab;&Tab;pwd</span>
9 changes: 9 additions & 0 deletions tests/cases/script.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[script: 'python3']
python_info:
import platform
print(platform.python_implementation(), platform.python_version())

[script('just', '-d', x'${PWD:-.}/', '-f')]
nested_justfile:
foo:
pwd

0 comments on commit 05f05b6

Please sign in to comment.