Skip to content

Commit fd83414

Browse files
committed
docs: update docs and faq to mention the new core utils
1 parent 6c645a3 commit fd83414

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

website/src/docs/faq.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,39 @@ a=foo
9797
echo $a
9898
```
9999

100-
## 'x' builtin command doesn't work on Windows
100+
## Are shell core utilities available on Windows?
101101

102-
The default shell on Windows (`cmd` and `powershell`) do not have commands like
103-
`rm` and `cp` available as builtins. This means that these commands won't work.
104-
If you want to make your Taskfile fully cross-platform, you'll need to work
105-
around this limitation using one of the following methods:
102+
The most common ones, yes. And we might add more in the future.
103+
This is possible because Task compiles a small set of core utilities in Go and
104+
enables them by default on Windows for greater compatibility.
106105

107-
- Use the <span v-pre>`{{OS}}`</span> function to run an OS-specific script.
108-
- Use something like
109-
<span v-pre>`{{if eq OS "windows"}}powershell {{end}}<my_cmd>`</span> to
110-
detect windows and run the command in Powershell directly.
111-
- Use a shell on Windows that supports these commands as builtins, such as [Git
112-
Bash][git-bash] or [WSL][wsl].
106+
It's possible to control whether these builtin core utilities are used or not
107+
with the [`TASK_CORE_UTILS`](/docs/reference/environment#task-core-utils)
108+
environment variable:
113109

114-
We want to make improvements to this part of Task and the issues below track
115-
this work. Constructive comments and contributions are very welcome!
110+
```bash
111+
# Enable, even on non-Windows platforms
112+
env TASK_CORE_UTILS=1 task ...
116113
117-
- #197
118-
- [mvdan/sh#93](https://github.com/mvdan/sh/issues/93)
119-
- [mvdan/sh#97](https://github.com/mvdan/sh/issues/97)
114+
# Disable, even on Windows
115+
env TASK_CORE_UTILS=0 task ...
116+
```
120117

121-
[git-bash]: https://gitforwindows.org/
122-
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/install
118+
This is the list of core utils that are currently available:
119+
120+
* `base64`
121+
* `cat`
122+
* `chmod`
123+
* `cp`
124+
* `find`
125+
* `gzip`
126+
* `ls`
127+
* `mkdir`
128+
* `mktemp`
129+
* `mv`
130+
* `rm`
131+
* `shasum`
132+
* `tar`
133+
* `touch`
134+
* `xargs`
135+
* (more might be added in the future)

website/src/docs/reference/environment.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ checksums and temporary metadata. Can be relative like `tmp/task` or absolute
2626
like `/tmp/.task` or `~/.task`. Relative paths are relative to the root
2727
Taskfile, not the working directory. Defaults to: `./.task`.
2828

29+
### `TASK_CORE_UTILS`
30+
31+
This env controls whether the Bash interpreter will use its own
32+
core utilities implemented in Go, or the ones available in the system.
33+
Valid values are `true` (`1`) or `false` (`0`). By default, this is `true` on
34+
Windows and `false` on other operating systems. We might consider making this
35+
enabled by default on all platforms in the future.
36+
2937
### `TASK_REMOTE_DIR`
3038

3139
Defines the location of Task's remote temporary directory which is used for

0 commit comments

Comments
 (0)