-
-
Notifications
You must be signed in to change notification settings - Fork 330
Open
Description
Currently templ fmt fails when SHELL is set to nushell
(✗) hello.templ [ error=failed to format file "hello.templ": prettier error: unable to format with command ["/run/current-system/sw/bin/nu" "-c" "prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME"], output: "Error: nu::parser::env_var_not_var\n\n x Use $env.TEMPL_PRETTIER_FILENAME instead of $TEMPL_PRETTIER_FILENAME.\n ,-[source:1:38]\n 1 | prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME\n : ^^^^^^^^^^^^|^^^^^^^^^^^\n : `-- use $env.TEMPL_PRETTIER_FILENAME instead of $TEMPL_PRETTIER_FILENAME\n `----\n\n", error: exit status 1 ]
(✓) Format Complete [ count=1 errors=1 changed=0 duration=18.599347ms ]
This happens because DEFAULT_COMMAND uses $TEMPL_PRETTIER_FILENAME, but nushell is not POSIX compliant and uses $env.VAR instead of $VAR.
While you can specify prettier command manually or set SHELL variable to POSIX compliant shell
SHELL=sh templ fmt hello.templ
# or
templ fmt -prettier-command "prettier --use-tabs --stdin-filepath $env.TEMPL_PRETTIER_FILENAME" hello.templit would be nice to support it by default.
I'm new to Go, but I can try to make a PR if maintainers are fine with that change.
Metadata
Metadata
Assignees
Labels
No labels