Docs: `Ensure a tool is installed locally` fails with `Error in format: format: nested replacement fields not supported`
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 413
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 6
Description
https://docs.tilt.dev/snippets.html#snip_require_local_tool:
Ensure a tool is installed locally
Check that a command exists in
PATHor fail the Tiltfile load.
$ tilt version
v0.30.5, built 2022-07-14
$ cat Tiltfile
# block Tiltfile execution if missing required tool (e.g. Helm)
def require_tool(tool):
tool = shlex.quote(tool)
local(
cmd='command -v {tool} >/dev/null 2>&1 || { echo >&2 "{tool} is required but was not found in PATH"; exit 1; }'.format(
tool=tool
),
# `cmd_bat`, when present, is used instead of `cmd` on Windows.
cmd_bat=[
"powershell.exe",
"-Noninteractive",
"-Command",
'& {{if (!(Get-Command {tool} -ErrorAction SilentlyContinue)) {{ Write-Error "{tool} is required but was not found in PATH"; exit 1 }}}}'.format(
tool=tool
),
],
)
require_tool("helm")
$ tilt up --stream
Tilt started on http://localhost:10350/
v0.30.5, built 2022-07-14
Initial Build
Loading Tiltfile at: /media/home/work/kubeshop.io/kusk-gateway/Tiltfile
ERROR: Traceback (most recent call last):
/media/home/work/kubeshop.io/kusk-gateway/Tiltfile:20:13: in <toplevel>
/media/home/work/kubeshop.io/kusk-gateway/Tiltfile:5:127: in require_tool
Error in format: format: nested replacement fields not supported
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the snippet at docs.tilt.dev/snippets.html#snip_require_local_tool and reproduce it in a Tiltfile using tilt up --stream. Update the documented example so the require_tool("helm") case no longer produces the nested replacement fields error, then verify the corrected snippet loads successfully.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100