#!/usr/bin/env bash

cat <<EOF >mise.toml
[task_config]
includes = [
	"tasks.toml",
	"mytasks",
]
[tasks.lint]
run = 'echo "linting!"'
EOF

cat <<EOF >tasks.toml
[test]
run = 'echo "testing!"'
[test-with-args]
run = 'echo "{{arg()}} {{flag(name="force")}} {{option(name="user")}}"'
EOF

mkdir -p .mise/tasks
cat <<'EOF' >.mise/tasks/do-not-show
#!/usr/bin/env bash
EOF
chmod +x .mise/tasks/do-not-show

mkdir -p mytasks
cat <<'EOF' >mytasks/filetask2
#!/usr/bin/env bash
EOF
chmod +x mytasks/filetask2

cat <<'EOF' >mytasks/filetask3.sh
#!/usr/bin/env bash
EOF
chmod +x mytasks/filetask3.sh

assert "mise task ls" "filetask2
filetask3
lint
test
test-with-args"

assert "mise task -x ls" "filetask2          ./mytasks/filetask2
filetask3          ./mytasks/filetask3.sh
lint               ./mise.toml
test               ./tasks.toml
test-with-args     ./tasks.toml"
