Skip to content

Built-in Functions

Use functions in variable expansion with {{function(arg)}} syntax.

FunctionDescriptionExample
uppercase(s)Convert to uppercase{{uppercase(hello)}}HELLO
lowercase(s)Convert to lowercase{{lowercase(HELLO)}}hello
trim(s)Remove whitespace{{trim( hello )}}hello
FunctionDescriptionExample
dirname(p)Get directory part{{dirname(/a/b/c.txt)}}/a/b
basename(p)Get filename part{{basename(/a/b/c.txt)}}c.txt
extension(p)Get file extension{{extension(file.txt)}}.txt
without_extension(p)Remove last extension{{without_extension(file.tar.gz)}}file.tar
without_extensions(p)Remove ALL extensions{{without_extensions(file.tar.gz)}}file
absolute_path(p)Get absolute path{{absolute_path(./src)}}/home/user/project/src
FunctionDescriptionExample
home()User home directory{{home()}}/Users/alice
local_bin(name)Path to ~/.local/bin binary{{local_bin("jake")}}/Users/alice/.local/bin/jake
shell_config()Current shell’s config file{{shell_config()}}/Users/alice/.zshrc

The shell_config() function detects your shell from $SHELL:

ShellConfig File
bash~/.bashrc
zsh~/.zshrc
fish~/.config/fish/config.fish
sh~/.profile
ksh~/.kshrc
csh~/.cshrc
tcsh~/.tcshrc
file_path = "src/components/Button.tsx"
task info:
echo "Directory: {{dirname(file_path)}}"
echo "Filename: {{basename(file_path)}}"
echo "Extension: {{extension(file_path)}}"

Output:

Directory: src/components
Filename: Button.tsx
Extension: .tsx
src = "src/main.ts"
task compile:
echo "Compiling {{basename(src)}} to {{without_extension(basename(src))}}.js"