1
0
mirror of https://github.com/go-task/task.git synced 2025-10-08 23:02:02 +02:00

docs: migrate website to vitepress (#2359)

Co-authored-by: Pete Davison <pd93.uk@outlook.com>
Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>
This commit is contained in:
Valentin Maerten
2025-08-12 18:09:19 +02:00
committed by GitHub
parent 64fc538a16
commit 79c93fb42b
137 changed files with 13639 additions and 19421 deletions

View File

@@ -8,6 +8,6 @@ charset = utf-8
trim_trailing_whitespace = true
indent_style = tab
[*.{md,mdx,yml,yaml,json,toml,htm,html,js,ts,css,svg,sh,bash,fish}]
[*.{md,mdx,yml,yaml,json,toml,htm,html,js,ts,vue,css,svg,sh,bash,fish}]
indent_style = space
indent_size = 2

View File

@@ -40,35 +40,4 @@ jobs:
run: python -m pip install 'check-jsonschema==0.27.3'
- name: check-jsonschema (metaschema)
run: check-jsonschema --check-metaschema website/static/schema.json
check_doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@v46
with:
files: website/versioned_docs/**
- uses: actions/github-script@v7
if: steps.changed-files-specific.outputs.any_changed == 'true'
with:
script: |
core.setFailed('website/versioned_docs has changed. Instead you need to update the docs in the website/docs folder.')
check_schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@v46
with:
files: |
website/static/schema.json
website/static/schema-taskrc.json
- uses: actions/github-script@v7
if: steps.changed-files-specific.outputs.any_changed == 'true'
with:
script: |
core.setFailed('schema.json or schema-taskrc.json has changed. Instead you need to update next-schema.json or next-schema-taskrc.json.')
run: check-jsonschema --check-metaschema website/src/public/schema.json

View File

@@ -19,6 +19,18 @@ jobs:
with:
go-version: 1.24.x
- name: Install Task
uses: arduino/setup-task@v2
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'pnpm'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
@@ -28,3 +40,8 @@ jobs:
env:
GITHUB_TOKEN: ${{secrets.GH_PAT}}
GORELEASER_KEY: ${{secrets.GORELEASER_KEY}}
- name: Deploy Website
shell: bash
run: |
task website:deploy:prod

View File

@@ -9,7 +9,6 @@ import (
"time"
"github.com/Masterminds/semver/v3"
"github.com/otiai10/copy"
"github.com/spf13/pflag"
"github.com/go-task/task/v3/errors"
@@ -17,13 +16,7 @@ import (
const (
changelogSource = "CHANGELOG.md"
changelogTarget = "website/docs/changelog.mdx"
docsSource = "website/docs"
docsTarget = "website/versioned_docs/version-latest"
schemaSource = "website/static/next-schema.json"
schemaTarget = "website/static/schema.json"
schemaTaskrcSource = "website/static/next-schema-taskrc.json"
schemaTaskrcTarget = "website/static/schema-taskrc.json"
changelogTarget = "website/docs/changelog.md"
)
var (
@@ -83,14 +76,6 @@ func release() error {
return err
}
if err := docs(); err != nil {
return err
}
if err := schema(); err != nil {
return err
}
return nil
}
@@ -173,23 +158,3 @@ func setJSONVersion(fileName string, version *semver.Version) error {
// Write the JSON file
return os.WriteFile(fileName, []byte(new), 0o644)
}
func docs() error {
if err := os.RemoveAll(docsTarget); err != nil {
return err
}
if err := copy.Copy(docsSource, docsTarget); err != nil {
return err
}
return nil
}
func schema() error {
if err := copy.Copy(schemaSource, schemaTarget); err != nil {
return err
}
if err := copy.Copy(schemaTaskrcSource, schemaTaskrcTarget); err != nil {
return err
}
return nil
}

18
website/.gitignore vendored
View File

@@ -1,21 +1,9 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
i18n
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vitepress/cache
.vitepress/dist
.task/

View File

1
website/.prettierignore Normal file
View File

@@ -0,0 +1 @@
pnpm-lock.yaml

5
website/.vitepress/components.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue';
const component: DefineComponent<{}, {}, any>;
export default component;
}

View File

@@ -0,0 +1,97 @@
<template>
<div class="author-compact" v-if="author">
<img :src="author.avatar" :alt="author.name" class="author-avatar" />
<div class="author-info">
<div class="author-name-line">
<span class="author-name">{{ author.name }}</span>
<div class="author-socials">
<a
v-for="{ link, icon } in author.links"
:key="link"
:href="link"
target="_blank"
class="social-link"
>
<span :class="`vpi-social-${icon}`"></span>
</a>
</div>
</div>
<span class="author-bio">{{ author.title }}</span>
</div>
</div>
</template>
<script setup>
import { team } from '../team.ts';
import { computed } from 'vue';
const props = defineProps({
author: String
});
const author = computed(() => {
return team.find((m) => m.slug === props.author) || null;
});
</script>
<style scoped>
.author-compact {
display: flex;
align-items: center;
gap: 0.75rem;
margin: 1.5rem 0;
}
.author-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
object-fit: cover;
}
.author-info {
display: flex;
flex-direction: column;
gap: 0.1rem;
flex: 1;
}
.author-name-line {
display: flex;
align-items: center;
gap: 0.75rem;
}
.author-name {
font-weight: 600;
color: var(--vp-c-text-1);
font-size: 0.95rem;
}
.author-bio {
color: var(--vp-c-text-2);
font-size: 0.85rem;
}
.author-socials {
display: flex;
gap: 0.5rem;
}
.social-link {
color: var(--vp-c-text-2);
transition: color 0.2s;
display: flex;
align-items: center;
}
.social-link:hover {
color: var(--vp-c-brand-1);
}
@media (max-width: 768px) {
.author-compact {
margin-bottom: 1rem;
}
}
</style>

View File

@@ -0,0 +1,182 @@
<template>
<article class="blog-post">
<div class="post-header">
<h3 class="post-title">
<a :href="url">{{ title }}</a>
</h3>
<div class="post-meta">
<time :datetime="date" class="post-date">
{{ formatDate(date) }}
</time>
</div>
</div>
<div class="post-content">
<div class="post-image" v-if="image">
<img :src="image" :alt="title" />
</div>
<div class="post-text">
<AuthorCard :author="author" />
<p class="post-description">{{ description }}</p>
<div class="post-footer">
<div class="post-tags" v-if="tags?.length">
<strong>Tags:</strong>
<code v-for="tag in tags" :key="tag" class="post-tag">{{
tag
}}</code>
</div>
<a :href="url" class="read-more"> Read more </a>
</div>
</div>
</div>
</article>
</template>
<script setup>
import AuthorCard from './AuthorCard.vue';
const props = defineProps({
title: String,
url: String,
date: String,
author: String,
description: String,
tags: Array,
image: String
});
function formatDate(date) {
return new Date(date).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
}
</script>
<style scoped>
.blog-post {
border-bottom: 1px solid var(--vp-c-divider);
padding-bottom: 2rem;
margin-bottom: 2rem;
}
.blog-post:last-child {
border-bottom: none;
margin-bottom: 0;
}
.post-title {
margin: 0 0 0.5rem 0;
font-size: 1.8rem;
font-weight: 600;
}
.post-title a {
transition: color 0.2s;
}
.post-title a:hover {
color: var(--vp-c-brand-1);
}
.post-date {
color: var(--vp-c-text-2);
font-size: 0.9rem;
}
.post-content {
display: flex;
gap: 2rem;
align-items: flex-start;
}
.post-image {
flex-shrink: 0;
width: 300px;
}
.post-image img {
width: 100%;
height: auto;
border-radius: 8px;
object-fit: cover;
aspect-ratio: 16 / 9;
}
.post-text {
flex: 1;
}
.post-description {
color: var(--vp-c-text-2);
line-height: 1.6;
margin: 1.5rem 0;
font-size: 1.05rem;
}
.post-footer {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-top: 1.5rem;
flex-wrap: wrap;
gap: 1rem;
}
.post-tags {
color: var(--vp-c-text-2);
font-size: 0.9rem;
}
.post-tag {
background: var(--vp-c-default-soft);
color: var(--vp-c-text-2);
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.8rem;
margin-left: 0.5rem;
font-family: var(--vp-font-family-mono);
}
.read-more {
color: var(--vp-c-brand-1);
text-decoration: none;
font-weight: 500;
transition: all 0.2s;
padding: 0.5rem 1rem;
border: 1px solid var(--vp-c-brand-1);
border-radius: 6px;
font-size: 0.9rem;
}
.read-more:hover {
background: var(--vp-c-brand-1);
color: white;
}
/* Responsive */
@media (max-width: 768px) {
.post-content {
flex-direction: column;
gap: 1rem;
}
.post-image {
width: 100%;
}
.post-title {
font-size: 1.5rem;
}
.post-footer {
flex-direction: column;
align-items: flex-start;
}
}
</style>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import { VPHomeSponsors } from 'vitepress/theme';
import { sponsors } from '../sponsors';
</script>
<template>
<div class="content">
<div class="content-container">
<main class="main">
<VPHomeSponsors
v-if="sponsors"
message="Task is free and open source, made possible by wonderful sponsors."
:data="sponsors"
/>
</main>
</div>
</div>
</template>
<style scoped></style>

View File

@@ -0,0 +1,245 @@
<script setup lang="ts">
import type { DefaultTheme } from 'vitepress/theme';
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
import VPSocialLinks from 'vitepress/dist/client/theme-default/components/VPSocialLinks.vue';
interface Props {
size?: 'small' | 'medium';
member: TeamMember;
}
interface TeamMember extends DefaultTheme.TeamMember {
icon?: string;
}
withDefaults(defineProps<Props>(), {
size: 'medium'
});
</script>
<template>
<article class="VPTeamMembersItem" :class="[size]">
<div class="profile">
<figure class="avatar">
<img class="avatar-img" :src="member.avatar" :alt="member.name" />
</figure>
<div class="data">
<h1 class="name">
<img :src="member.icon" alt="profile-icon" />
{{ member.name }}
</h1>
<p v-if="member.title || member.org" class="affiliation">
<span v-if="member.title" class="title">
{{ member.title }}
</span>
<span v-if="member.title && member.org" class="at"> @ </span>
<VPLink
v-if="member.org"
class="org"
:class="{ link: member.orgLink }"
:href="member.orgLink"
no-icon
>
{{ member.org }}
</VPLink>
</p>
<p v-if="member.desc" class="desc" v-html="member.desc" />
<div v-if="member.links" class="links">
<VPSocialLinks :links="member.links" :me="false" />
</div>
</div>
</div>
<div v-if="member.sponsor" class="sp">
<VPLink class="sp-link" :href="member.sponsor" no-icon>
<span class="vpi-heart sp-icon" /> {{ member.actionText || 'Sponsor' }}
</VPLink>
</div>
</article>
</template>
<style scoped>
.VPTeamMembersItem {
display: flex;
flex-direction: column;
gap: 2px;
border-radius: 12px;
width: 100%;
height: 100%;
overflow: hidden;
}
.VPTeamMembersItem.small .profile {
padding: 32px;
}
.VPTeamMembersItem.small .data {
padding-top: 20px;
}
.VPTeamMembersItem.small .avatar {
width: 64px;
height: 64px;
}
.VPTeamMembersItem.small .name {
line-height: 24px;
font-size: 16px;
}
.VPTeamMembersItem.small .affiliation {
padding-top: 4px;
line-height: 20px;
font-size: 14px;
}
.VPTeamMembersItem.small .desc {
padding-top: 12px;
line-height: 20px;
font-size: 14px;
}
.VPTeamMembersItem.small .links {
margin: 0 -16px -20px;
padding: 10px 0 0;
}
.VPTeamMembersItem.medium .profile {
padding: 48px 32px;
}
.VPTeamMembersItem.medium .data {
padding-top: 24px;
text-align: center;
}
.VPTeamMembersItem.medium .avatar {
width: 96px;
height: 96px;
}
.VPTeamMembersItem.medium .name {
letter-spacing: 0.15px;
line-height: 28px;
font-size: 20px;
}
.VPTeamMembersItem.medium .affiliation {
padding-top: 4px;
font-size: 16px;
}
.VPTeamMembersItem.medium .desc {
padding-top: 16px;
max-width: 288px;
font-size: 16px;
}
.VPTeamMembersItem.medium .links {
margin: 0 -16px -12px;
padding: 16px 12px 0;
}
.VPTeamMembersItem .profile .name {
display: flex;
gap: 8px;
align-items: center;
justify-content: center;
}
.VPTeamMembersItem .profile .name img {
display: inline-block;
height: 22px;
background-repeat: no-repeat;
}
.profile {
flex-grow: 1;
background-color: var(--vp-c-bg-soft);
}
.data {
text-align: center;
}
.avatar {
position: relative;
flex-shrink: 0;
margin: 0 auto;
border-radius: 50%;
box-shadow: var(--vp-shadow-3);
}
.avatar-img {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: 50%;
object-fit: cover;
}
.name {
margin: 0;
font-weight: 600;
}
.affiliation {
margin: 0;
font-weight: 500;
color: var(--vp-c-text-2);
}
.org.link {
color: var(--vp-c-text-2);
transition: color 0.25s;
}
.org.link:hover {
color: var(--vp-c-brand-1);
}
.desc {
margin: 0 auto;
}
.desc :deep(a) {
font-weight: 500;
color: var(--vp-c-brand-1);
text-decoration-style: dotted;
transition: color 0.25s;
}
.links {
display: flex;
justify-content: center;
height: 56px;
}
.sp-link {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
padding: 16px;
font-size: 14px;
font-weight: 500;
color: var(--vp-c-sponsor);
background-color: var(--vp-c-bg-soft);
transition:
color 0.25s,
background-color 0.25s;
}
.sp .sp-link.link:hover,
.sp .sp-link.link:focus {
outline: none;
color: var(--vp-c-white);
background-color: var(--vp-c-sponsor);
}
.sp-icon {
margin-right: 8px;
font-size: 16px;
}
</style>

View File

@@ -0,0 +1,7 @@
<script setup lang="ts">
import { VPBadge } from 'vitepress/theme';
</script>
<template>
<VPBadge type="info"> <slot />+ </VPBadge>
</template>

View File

@@ -0,0 +1,298 @@
import { defineConfig } from 'vitepress';
import githubLinksPlugin from './plugins/github-links';
import { readFileSync } from 'fs';
import { resolve } from 'path';
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs';
import {
groupIconMdPlugin,
groupIconVitePlugin
} from 'vitepress-plugin-group-icons';
import { team } from './team.ts';
import { ogUrl, taskDescription, taskName } from './meta.ts';
import { fileURLToPath, URL } from 'node:url';
const version = readFileSync(
resolve(__dirname, '../../internal/version/version.txt'),
'utf8'
).trim();
const urlVersion =
process.env.NODE_ENV === 'development'
? {
current: 'https://taskfile.dev/',
next: 'http://localhost:3002/'
}
: {
current: 'https://taskfile.dev/',
next: 'https://next.taskfile.dev/'
};
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: taskName,
description: taskDescription,
lang: 'en-US',
head: [
[
'link',
{
rel: 'icon',
type: 'image/x-icon',
href: '/img/favicon.icon',
sizes: '48x48'
}
],
[
'link',
{
rel: 'icon',
sizes: 'any',
type: 'image/svg+xml',
href: '/img/logo.svg'
}
],
[
'link',
{
rel: 'canonical',
href: 'https://taskfile.dev/'
}
],
[
'meta',
{ name: 'author', content: `${team.map((c) => c.name).join(', ')}` }
],
[
'meta',
{
name: 'keywords',
content:
'task runner, build tool, taskfile, yaml build tool, go task runner, make alternative, cross-platform build tool, makefile alternative, automation tool, ci cd pipeline, developer productivity, build automation, command line tool, go binary, yaml configuration'
}
],
['meta', { property: 'og:title', content: taskName }],
['meta', { property: 'og:description', content: taskDescription }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:site_name', content: taskName }],
['meta', { property: 'og:url', content: ogUrl }],
['meta', { property: 'twitter:card', content: 'summary_large_image' }],
['meta', { property: 'twitter:title', content: taskName }],
['meta', { property: 'twitter:description', content: taskDescription }]
],
srcDir: 'src',
cleanUrls: true,
markdown: {
config: (md) => {
md.use(githubLinksPlugin, {
baseUrl: 'https://github.com',
repo: 'go-task/task'
});
md.use(tabsMarkdownPlugin);
md.use(groupIconMdPlugin);
}
},
vite: {
plugins: [groupIconVitePlugin()],
resolve: {
alias: [
{
find: /^.*\/VPTeamMembersItem\.vue$/,
replacement: fileURLToPath(
new URL('./components/VPTeamMembersItem.vue', import.meta.url)
)
}
]
}
},
themeConfig: {
logo: '/img/logo.svg',
carbonAds: {
code: 'CESI65QJ',
placement: 'taskfiledev'
},
search: {
provider: 'local'
// options: {
// appId: '...',
// apiKey: '...',
// indexName: '...'
// }
},
nav: [
{ text: 'Home', link: '/' },
{
text: 'Docs',
link: '/docs/guide',
activeMatch: '^/docs'
},
{ text: 'Blog', link: '/blog', activeMatch: '^/blog' },
{ text: 'Donate', link: '/donate' },
{ text: 'Team', link: '/team' },
{
text: process.env.NODE_ENV === 'development' ? 'Next' : `v${version}`,
items: [
{
items: [
{
text: `v${version}`,
link: urlVersion.current
},
{
text: 'Next',
link: urlVersion.next
}
]
}
]
}
],
sidebar: {
'/blog/': [
{
text: '2024',
collapsed: false,
items: [
{
text: 'Any Variables',
link: '/blog/any-variables'
}
]
},
{
text: '2023',
collapsed: false,
items: [
{
text: 'Introducing Experiments',
link: '/blog/task-in-2023'
}
]
}
],
'/': [
{
text: 'Installation',
link: '/docs/installation'
},
{
text: 'Getting Started',
link: '/docs/getting-started'
},
{
text: 'Guide',
link: '/docs/guide'
},
{
text: 'Reference',
collapsed: true,
items: [
{
text: 'CLI',
link: '/docs/reference/cli'
},
{
text: 'Schema',
link: '/docs/reference/schema'
},
{
text: 'Templating',
link: '/docs/reference/templating'
},
{
text: 'Package API',
link: '/docs/reference/package'
}
]
},
{
text: 'Experiments',
collapsed: true,
link: '/docs/experiments/',
items: [
{
text: 'Env Precedence (#1038)',
link: '/docs/experiments/env-precedence'
},
{
text: 'Gentle Force (#1200)',
link: '/docs/experiments/gentle-force'
},
{
text: 'Remote Taskfiles (#1317)',
link: '/docs/experiments/remote-taskfiles'
}
]
},
{
text: 'Deprecations',
collapsed: true,
link: '/docs/deprecations/',
items: [
{
text: 'Completion Scripts',
link: '/docs/deprecations/completion-scripts'
},
{
text: 'Template Functions',
link: '/docs/deprecations/template-functions'
},
{
text: 'Version 2 Schema (#1197)',
link: '/docs/deprecations/version-2-schema'
}
]
},
{
text: 'Taskfile Versions',
link: '/docs/taskfile-versions'
},
{
text: 'Integrations',
link: '/docs/integrations'
},
{
text: 'Community',
link: '/docs/community'
},
{
text: 'Style Guide',
link: '/docs/styleguide'
},
{
text: 'Contributing',
link: '/docs/contributing'
},
{
text: 'Releasing',
link: '/docs/releasing'
},
{
text: 'Changelog',
link: '/docs/changelog'
},
{
text: 'FAQ',
link: '/docs/faq'
}
],
// Hacky to disable sidebar for these pages
'/donate': [],
'/team': []
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/go-task/task' },
{ icon: 'discord', link: 'https://discord.gg/6TY36E39UK' },
{ icon: 'x', link: 'https://twitter.com/taskfiledev' },
{ icon: 'bluesky', link: 'https://bsky.app/profile/taskfile.dev' },
{ icon: 'mastodon', link: 'https://fosstodon.org/@task' }
],
footer: {
message:
'Built with <a target="_blank" href="https://www.netlify.com">Netlify</a>'
}
}
});

View File

@@ -0,0 +1,5 @@
export const taskName = 'Task';
export const taskDescription =
'A fast, cross-platform build tool inspired by Make, designed for modern workflows.';
export const ogUrl = 'https://taskfile.dev/';

View File

@@ -0,0 +1,63 @@
import type MarkdownIt from 'markdown-it';
interface PluginOptions {
repo: string;
}
function githubLinksPlugin(
md: MarkdownIt,
options: PluginOptions = {} as PluginOptions
): void {
const baseUrl = 'https://github.com';
const { repo } = options;
md.core.ruler.after('inline', 'github-links', (state): void => {
const tokens = state.tokens;
for (let i = 0; i < tokens.length; i++) {
if (tokens[i].type === 'inline' && tokens[i].children) {
const inlineTokens = tokens[i].children!;
for (let j = 0; j < inlineTokens.length; j++) {
if (inlineTokens[j].type === 'text') {
let text: string = inlineTokens[j].content!;
const protectedRefs: string[] = [];
let protectIndex: number = 0;
text = text.replace(
/[\w.-]+\/[\w.-]+#(\d+)/g,
(match: string): string => {
const placeholder: string = `__PROTECTED_${protectIndex}__`;
protectedRefs[protectIndex] = match;
protectIndex++;
return placeholder;
}
);
text = text.replace(
/#(\d+)/g,
`<a href="${baseUrl}/${repo}/issues/$1" target="_blank" class="github-pr-link">#$1</a>`
);
text = text.replace(
/@([a-zA-Z0-9_-]+)(?![\w@.])/g,
`<a href="${baseUrl}/$1" target="_blank" class="github-user-mention">@$1</a>`
);
protectedRefs.forEach((ref: string, index: number): void => {
text = text.replace(`__PROTECTED_${index}__`, ref);
});
if (text !== inlineTokens[j].content) {
inlineTokens[j].content = text;
inlineTokens[j].type = 'html_inline';
}
}
}
}
}
});
}
export default githubLinksPlugin;

View File

@@ -0,0 +1,13 @@
export const sponsors = [
{
tier: 'Gold Sponsors',
size: 'big',
items: [
{
name: 'devowl',
url: 'https://devowl.io/',
img: '/img/devowl.io.svg'
}
]
}
];

View File

@@ -0,0 +1,45 @@
export const team = [
{
slug: 'andreynering',
avatar: 'https://www.github.com/andreynering.png',
name: 'Andrey Nering',
icon: '/img/flag-brazil.svg',
title: 'Creator & Maintainer',
sponsor: 'https://github.com/sponsors/andreynering',
links: [
{ icon: 'github', link: 'https://github.com/andreynering' },
{ icon: 'discord', link: 'https://discord.com/users/310141681926275082' },
{ icon: 'x', link: 'https://x.com/andreynering' },
{
icon: 'bluesky',
link: 'https://bsky.app/profile/andreynering.bsky.social'
},
{ icon: 'mastodon', link: 'https://mastodon.social/@andreynering' }
]
},
{
slug: 'pd93',
avatar: 'https://www.github.com/pd93.png',
name: 'Pete Davison',
icon: '/img/flag-wales.svg',
title: 'Maintainer',
sponsor: 'https://github.com/sponsors/pd93',
links: [
{ icon: 'github', link: 'https://github.com/pd93' },
{ icon: 'bluesky', link: 'https://bsky.app/profile/pd93.uk' }
]
},
{
slug: 'vmaerten',
avatar: 'https://www.github.com/vmaerten.png',
name: 'Valentin Maerten',
icon: '/img/flag-france.svg',
title: 'Maintainer',
sponsor: 'https://github.com/sponsors/vmaerten',
links: [
{ icon: 'github', link: 'https://github.com/vmaerten' },
{ icon: 'x', link: 'https://x.com/v_maerten' },
{ icon: 'bluesky', link: 'https://bsky.app/profile/vmaerten.bsky.social' }
]
}
];

View File

@@ -0,0 +1,142 @@
:root {
--ifm-color-primary: #43aba2;
--vp-home-hero-name-color: var(--ifm-color-primary);
--vp-c-brand-1: var(--ifm-color-primary);
--vp-c-brand-2: var(--ifm-color-primary);
--vp-c-brand-3: var(--ifm-color-primary);
--vp-icon-info: #3b82f6;
--vp-icon-tip: #10b981;
--vp-icon-warning: #f59e0b;
--vp-icon-danger: #ef4444;
--vp-icon-details: #6b7280;
}
.dark {
--vp-icon-info: #93c5fd;
--vp-icon-tip: #34d399;
--vp-icon-warning: #fbbf24;
--vp-icon-danger: #f87171;
--vp-icon-details: #9ca3af;
}
img[src*='shields.io'] {
display: inline;
vertical-align: text-bottom;
}
img[src*='custom-icon-badges.demolab.com'] {
display: inline;
height: 1em;
vertical-align: text-bottom;
}
.github-user-mention {
font-weight: 700 !important;
}
.vp-doc .blog-post:first-of-type {
margin-top: 2rem;
}
.blog-post {
animation: fadeInUp 0.6s ease-out;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.blog-post:nth-of-type(1) {
animation-delay: 0.1s;
}
.blog-post:nth-of-type(2) {
animation-delay: 0.2s;
}
.blog-post:nth-of-type(3) {
animation-delay: 0.3s;
}
.custom-block .custom-block-title::before {
content: '';
display: inline-block;
width: 20px;
height: 20px;
margin-right: 8px;
vertical-align: middle;
flex-shrink: 0;
-webkit-mask-repeat: no-repeat;
-webkit-mask-position: center;
-webkit-mask-size: contain;
mask-repeat: no-repeat;
mask-position: center;
mask-size: contain;
}
.custom-block.info .custom-block-title::before {
background-color: var(--vp-icon-info);
-webkit-mask-image: url('./icons/info.svg');
mask-image: url('./icons/info.svg');
}
.custom-block.tip .custom-block-title::before {
background-color: var(--vp-icon-tip);
-webkit-mask-image: url('./icons/tip.svg');
mask-image: url('./icons/tip.svg');
}
.custom-block.warning .custom-block-title::before {
background-color: var(--vp-icon-warning);
-webkit-mask-image: url('./icons/warning.svg');
mask-image: url('./icons/warning.svg');
}
.custom-block.danger .custom-block-title::before {
background-color: var(--vp-icon-danger);
-webkit-mask-image: url('./icons/danger.svg');
mask-image: url('./icons/danger.svg');
}
.custom-block.details[open] summary::before {
transform: rotate(90deg);
}
.custom-block .custom-block-title {
display: flex;
align-items: center;
}
@supports not (mask-image: none) {
.custom-block .custom-block-title::before,
.custom-block.details summary::before {
font-size: 18px;
width: auto;
height: auto;
background: none !important;
-webkit-mask: none !important;
mask: none !important;
}
.custom-block.info .custom-block-title::before {
content: 'ℹ️';
}
.custom-block.tip .custom-block-title::before {
content: '💡';
}
.custom-block.warning .custom-block-title::before {
content: '⚠️';
}
.custom-block.danger .custom-block-title::before {
content: '🔥';
}
}

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
<path d="M7.998 14.5c2.832 0 5-1.98 5-4.5 0-1.463-.68-2.19-1.879-3.383l-.036-.037c-1.013-1.008-2.3-2.29-2.834-4.434-.322.256-.63.579-.864.953-.432.696-.621 1.58-.046 2.73.473.947.67 2.284-.278 3.232-.61.61-1.545.84-2.403.633a2.788 2.788 0 0 1-1.436-.874A3.21 3.21 0 0 0 3 10c0 2.53 2.164 4.5 4.998 4.5zM9.533.753C9.496.34 9.16.009 8.77.146 7.035.75 4.34 3.187 5.997 6.5c.344.689.285 1.218.003 1.5-.419.419-1.54.487-2.04-.832-.173-.454-.659-.762-1.035-.454C2.036 7.44 1.5 8.702 1.5 10c0 3.512 2.998 6 6.498 6s6.5-2.5 6.5-6c0-2.137-1.128-3.26-2.312-4.438-1.19-1.184-2.436-2.425-2.653-4.81z"/>
</svg>

After

Width:  |  Height:  |  Size: 681 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
<path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 350 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"/>
</svg>

After

Width:  |  Height:  |  Size: 796 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
<path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 405 B

View File

@@ -0,0 +1,24 @@
import DefaultTheme from 'vitepress/theme';
import type { Theme } from 'vitepress';
import './custom.css';
import HomePage from '../components/HomePage.vue';
import AuthorCard from '../components/AuthorCard.vue';
import BlogPost from '../components/BlogPost.vue';
import Version from '../components/Version.vue';
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client';
import { h } from 'vue';
import 'virtual:group-icons.css';
export default {
extends: DefaultTheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'home-features-after': () => h(HomePage)
});
},
enhanceApp({ app }) {
app.component('AuthorCard', AuthorCard);
app.component('BlogPost', BlogPost);
app.component('Version', Version);
enhanceAppWithTabs(app);
}
} satisfies Theme;

View File

@@ -1,29 +1,35 @@
version: "3"
version: '3'
tasks:
yarn:install:
desc: Setup Docusaurus locally
install:
desc: Setup VitePress locally
cmds:
- yarn install
- pnpm install
sources:
- package.json
- yarn.lock
- pnpm-lock.yaml
default:
desc: Start website
deps: [yarn:install]
deps: [install]
aliases: [s, start]
vars:
HOST: '{{default "0.0.0.0" .HOST}}'
PORT: '{{default "3001" .PORT}}'
cmds:
- npx docusaurus start --no-open --host={{.HOST}} --port={{.PORT}}
- pnpm dev --host={{.HOST}} --port={{.PORT}}
lint:
desc: Lint website
deps: [install]
cmds:
- pnpm lint
build:
desc: Build website
deps: [yarn:install]
deps: [install]
cmds:
- npx docusaurus build
- pnpm build
preview:
desc: Preview Website
@@ -33,20 +39,21 @@ tasks:
HOST: '{{default "localhost" .HOST}}'
PORT: '{{default "3001" .PORT}}'
cmds:
- npx docusaurus serve --no-open --host={{.HOST}} --port={{.PORT}}
- pnpm preview --host={{.HOST}} --port={{.PORT}}
clean:
desc: Clean temp directories
cmds:
- rm -rf ./build
- rm -rf ./vitepress/dist
deploy:
desc: Build and deploy Docusaurus
summary: Requires GIT_USER and GIT_PASS envs to be previous set
deploy:next:
deps: [build]
desc: Build and deploy next.taskfile.dev
cmds:
- npx docusaurus deploy
- pnpm netlify deploy --prod --site=4e13dfcf-fc0d-4bec-ad60-b918a8dc3942
upgrade:
desc: Upgrade Docusaurus
deploy:prod:
deps: [build]
desc: Build and deploy taskfile.dev
cmds:
- yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest @docusaurus/module-type-aliases@latest @docusaurus/tsconfig@latest @docusaurus/types@latest
- pnpm netlify deploy --prod --site=e625bc6a-1cd3-465d-ad30-7bbddaeb4f31

View File

@@ -1,3 +0,0 @@
export default {
presets: ['@docusaurus/core/lib/babel/preset'],
};

View File

@@ -1,10 +0,0 @@
andreynering:
name: Andrey Nering
title: Maintainer of Task
url: https://github.com/andreynering
image_url: https://github.com/andreynering.png
pd93:
name: Pete Davison
title: Maintainer of Task
url: https://github.com/pd93
image_url: https://github.com/pd93.png

View File

@@ -1,7 +0,0 @@
export const GITHUB_URL = 'https://github.com/go-task/task';
export const TWITTER_URL = 'https://twitter.com/taskfiledev';
export const BLUESKY_URL = 'https://bsky.app/profile/taskfile.dev';
export const MASTODON_URL = 'https://fosstodon.org/@task';
export const DISCORD_URL = 'https://discord.gg/6TY36E39UK';
export const STACK_OVERFLOW = 'https://stackoverflow.com/questions/tagged/taskfile';
export const ANSWER_OVERFLOW = 'https://www.answeroverflow.com/c/974121106208354339';

View File

@@ -1,25 +0,0 @@
---
slug: /deprecations/completion-scripts/
---
# Completion Scripts
:::warning
This deprecation breaks the following functionality:
- Any direct references to the completion scripts in the Task git repository
:::
Direct use of the completion scripts in the `completion/*` directory of the
[github.com/go-task/task][task] Git repository is deprecated. Any shell
configuration that directly refers to these scripts will potentially break in
the future as the scripts may be moved or deleted entirely. Any configuration
should be updated to use the [new method for generating shell
completions][completions] instead.
{/* prettier-ignore-start */}
[completions]: ../installation.mdx#setup-completions
[task]: https://github.com/go-task/task
{/* prettier-ignore-end */}

View File

@@ -1,19 +0,0 @@
---
slug: /deprecations/
sidebar_position: 8
---
# Deprecations
As Task evolves, it occasionally outgrows some of its functionality. This can be
because they are no longer useful, because another feature has replaced it or
because of a change in the way that Task works internally.
When this happens, we mark the functionality as deprecated. This means that it
will be removed in a future version of Task. This functionality will continue to
work until that time, but we strongly recommend that you do not implement this
functionality in new Taskfiles and make a plan to migrate away from it as soon
as possible.
You can view a full list of active deprecations in the "Deprecations" section of
the sidebar.

View File

@@ -1,23 +0,0 @@
---
# This is a template for an experiments documentation
# Copy this page and fill in the details as necessary
title: '--- Template ---'
sidebar_position: -1 # Always push to the top
draft: true # Hide in production
---
# \{Name of Deprecated Feature\} (#\{Issue\})
:::warning
This deprecation breaks the following functionality:
- \{list any existing functionality that will be broken by this deprecation\}
- \{if there are no breaking changes, remove this admonition\}
:::
\{Short description of the feature/behavior and why it is being deprecated\}
\{Short explanation of any replacement features/behaviors and how users should
migrate to it\}

View File

@@ -1,23 +0,0 @@
---
slug: /deprecations/template-functions/
---
# Template Functions
:::warning
This deprecation breaks the following functionality:
- A small set of templating functions
:::
The following templating functions are deprecated. Any replacement functions are
listed besides the function being removed.
| Deprecated function | Replaced by |
| ------------------- | ----------- |
| `IsSH` | - |
| `FromSlash` | `fromSlash` |
| `ToSlash` | `toSlash` |
| `ExeExt` | `exeExt` |

View File

@@ -1,33 +0,0 @@
---
slug: /deprecations/version-2-schema/
---
# Version 2 Schema (#1197)
:::warning
This deprecation breaks the following functionality:
- Any Taskfiles that use the version 2 schema
- `Taskvar.yml` files
:::
The Taskfile version 2 schema was introduced in March 2018 and replaced by
version 3 in August 2019. In May 2023 [we published a deprecation
notice][deprecation-notice] for the version 2 schema on the basis that the vast
majority of users had already upgraded to version 3 and removing support for
version 2 would allow us to tidy up the codebase and focus on new functionality
instead.
In December 2023, the final version of Task that supports the version 2 schema
([v3.33.0][v3.33.0]) was published and all legacy code was removed from Task's
main branch. To use a more recent version of Task, you will need to ensure that
your Taskfile uses the version 3 schema instead. A list of changes between
version 2 and version 3 are available in the [Task v3 Release Notes][v3.0.0].
{/* prettier-ignore-start */}
[v3.0.0]: https://github.com/go-task/task/releases/tag/v3.0.0
[v3.33.0]: https://github.com/go-task/task/releases/tag/v3.33.0
[deprecation-notice]: https://github.com/go-task/task/issues/1197
{/* prettier-ignore-end */}

View File

@@ -1,74 +0,0 @@
---
slug: '/experiments/env-precedence'
---
# Env Precedence (#1038)
:::caution
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
environment. They are intended for testing and feedback only.
:::
:::warning
This experiment breaks the following functionality:
- environment variable will take precedence over OS environment variables
:::
:::info
To enable this experiment, set the environment variable:
`TASK_X_ENV_PRECEDENCE=1`. Check out [our guide to enabling
experiments][enabling-experiments] for more information.
:::
Before this experiment, the OS variable took precedence over the task
environment variable. This experiment changes the precedence to make the task
environment variable take precedence over the OS variable.
Consider the following example:
```yml
version: '3'
tasks:
default:
env:
KEY: 'other'
cmds:
- echo "$KEY"
```
Running `KEY=some task` before this experiment, the output would be `some`, but
after this experiment, the output would be `other`.
If you still want to get the OS variable, you can use the template function env
like follow : `{{env "OS_VAR"}}`.
```yml
version: '3'
tasks:
default:
env:
KEY: 'other'
cmds:
- echo "$KEY"
- echo {{env "KEY"}}
```
Running `KEY=some task`, the output would be `other` and `some`.
Like other variables/envs, you can also fall back to a given value using the
default template function:
```yml
MY_ENV: '{{.MY_ENV | default "fallback"}}'
```
{/* prettier-ignore-start */}
[enabling-experiments]: ./experiments.mdx#enabling-experiments
{/* prettier-ignore-end */}

View File

@@ -1,151 +0,0 @@
---
slug: /experiments/
sidebar_position: 7
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Experiments
:::caution
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
environment. They are intended for testing and feedback only.
:::
In order to allow Task to evolve quickly, we sometimes roll out breaking changes
to minor versions behind experimental flags. This allows us to gather feedback
on breaking changes before committing to a major release. This process can also
be used to gather feedback on important non-breaking features before their
design is completed. This document describes the
[experiment workflow](#workflow) and how you can get involved.
You can view the full list of active experiments in the sidebar submenu to the
left of the page and click on each one to find out more about it.
## Enabling Experiments
Task uses environment variables to detect whether or not an experiment is
enabled. All of the experiment variables will begin with the same `TASK_X_`
prefix followed by the name of the experiment. You can find the exact name for
each experiment on their respective pages in the sidebar. If the variable is set
`=1` then it will be enabled. Some experiments may have multiple proposals, in
which case, you will need to set the variable equal to the number of the
proposal that you want to enable (`=2`, `=3` etc).
There are three main ways to set the environment variables for an experiment.
Which method you use depends on how you intend to use the experiment:
1. Prefixing your task commands with the relevant environment variable(s). For
example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off
invocations of Task to test out experimental features.
2. Adding the relevant environment variable(s) in your "dotfiles" (e.g.
`.bashrc`, `.zshrc` etc.). This will permanently enable experimental features
for your personal environment.
```shell title="~/.bashrc"
export TASK_X_FEATURE=1
```
3. Creating a `.env` or a `.taskrc.yml` file in the same directory as
your root Taskfile.\
The `.env` file should contain the relevant environment
variable(s), while the `.taskrc.yml` file should use a YAML format
where each experiment is defined as a key with a corresponding value.
This allows you to enable an experimental feature at a project level. If you
commit this file to source control, then other users of your project will
also have these experiments enabled.
If both files are present, the values in the `.taskrc.yml` file
will take precedence.
<Tabs values={[ {label: '.taskrc.yml', value: 'yaml'}, {label: '.env', value: 'env'}]}>
<TabItem value="yaml">
```yaml title=".taskrc.yml"
experiments:
FEATURE: 1
```
</TabItem>
<TabItem value="env">
```shell title=".env"
TASK_X_FEATURE=1
```
</TabItem>
</Tabs>
## Workflow
Experiments are a way for us to test out new features in Task before committing
to them in a major release. Because this concept is built around the idea of
feedback from our community, we have built a workflow for the process of
introducing these changes. This ensures that experiments are given the attention
and time that they need and that we are getting the best possible results out of
them.
The sections below describe the various stages that an experiment must go
through from its proposal all the way to being released in a major version of
Task.
### 1. Proposal
All experimental features start with a proposal in the form of a GitHub issue.
If the maintainers decide that an issue has enough support and is a breaking
change or is complex/controversial enough to require user feedback, then the
issue will be marked with the `status: proposal` label. At this point, the issue
becomes a proposal and a period of consultation begins. During this period, we
request that users provide feedback on the proposal and how it might effect
their use of Task. It is up to the discretion of the maintainers to decide how
long this period lasts.
### 2. Draft
Once a proposal's consultation ends, a contributor may pick up the work and
begin the initial implementation. Once a PR is opened, the maintainers will
ensure that it meets the requirements for an experimental feature (i.e. flags
are in the right format etc) and merge the feature. Once this code is released,
the status will be updated via the `status: draft` label. This indicates that an
implementation is now available for use in a release and the experiment is open
for feedback.
:::note
During the draft period, major changes to the implementation may be made based
on the feedback received from users. There are _no stability guarantees_ and
experimental features may be abandoned _at any time_.
:::
### 3. Candidate
Once an acceptable level of consensus has been reached by the community and
feedback/changes are less frequent/significant, the status may be updated via
the `status: candidate` label. This indicates that a proposal is _likely_ to
accepted and will enter a period for final comments and minor changes.
### 4. Stable
Once a suitable amount of time has passed with no changes or feedback, an
experiment will be given the `status: stable` label. At this point, the
functionality will be treated like any other feature in Task and any changes
_must_ be backward compatible. This allows users to migrate to the new
functionality without having to worry about anything breaking in future
releases. This provides the best experience for users migrating to a new major
version.
### 5. Released
When making a new major release of Task, all experiments marked as `status:
stable` will move to `status: released` and their behaviors will become the new
default in Task. Experiments in an earlier stage (i.e. not stable) cannot be
released and so will continue to be experiments in the new version.
### Abandoned / Superseded
If an experiment is unsuccessful at any point then it will be given the `status:
abandoned` or `status: superseded` labels depending on which is more suitable.
These experiments will be removed from Task.

View File

@@ -1,290 +0,0 @@
---
slug: /experiments/remote-taskfiles/
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Remote Taskfiles (#1317)
:::caution
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
environment. They are intended for testing and feedback only.
:::
:::info
To enable this experiment, set the environment variable:
`TASK_X_REMOTE_TASKFILES=1`. Check out [our guide to enabling experiments
][enabling-experiments] for more information.
:::
:::danger
Never run remote Taskfiles from sources that you do not trust.
:::
This experiment allows you to use Taskfiles which are stored in remote
locations. This applies to both the root Taskfile (aka. Entrypoint) and also
when including Taskfiles.
Task uses "nodes" to reference remote Taskfiles. There are a few different types
of node which you can use:
<Tabs groupId="method" queryString>
<TabItem value="http" label="HTTP/HTTPS">
`https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml`
This is the most basic type of remote node and works by downloading the file
from the specified URL. The file must be a valid Taskfile and can be of any
name. If a file is not found at the specified URL, Task will append each of the
[supported file names][supported-file-names] in turn until it finds a valid
file. If it still does not find a valid Taskfile, an error is returned.
</TabItem>
<TabItem value="git-http" label="Git over HTTP">
`https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main`
This type of node works by downloading the file from a Git repository over
HTTP/HTTPS. The first part of the URL is the base URL of the Git repository.
This is the same URL that you would use to clone the repo over HTTP.
- You can optionally add the path to the Taskfile in the repository by appending
`//<path>` to the URL.
- You can also optionally specify a branch or tag to use by appending
`?ref=<ref>` to the end of the URL. If you omit a reference, the default branch
will be used.
</TabItem>
<TabItem value="git-ssh" label="Git over SSH">
`git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main`
This type of node works by downloading the file from a Git repository over SSH.
The first part of the URL is the user and base URL of the Git repository. This
is the same URL that you would use to clone the repo over SSH.
To use Git over SSH, you need to make sure that your SSH agent has your private
SSH keys added so that they can be used during authentication.
- You can optionally add the path to the Taskfile in the repository by appending
`//<path>` to the URL.
- You can also optionally specify a branch or tag to use by appending
`?ref=<ref>` to the end of the URL. If you omit a reference, the default branch
will be used.
</TabItem>
</Tabs>
Task has an [example remote Taskfile][example-remote-taskfile] in our repository
that you can use for testing and that we will use throughout this document:
```yaml
version: '3'
tasks:
default:
cmds:
- task: hello
hello:
cmds:
- echo "Hello Task!"
```
## Specifying a remote entrypoint
By default, Task will look for one of the [supported file
names][supported-file-names] on your local filesystem. If you want to use a
remote file instead, you can pass its URI into the `--taskfile`/`-t` flag just
like you would to specify a different local file. For example:
<Tabs groupId="method" queryString>
<TabItem value="http" label="HTTP/HTTPS">
```shell
$ task --taskfile https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
task: [hello] echo "Hello Task!"
Hello Task!
```
</TabItem>
<TabItem value="git-http" label="Git over HTTP">
```shell
$ task --taskfile https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
task: [hello] echo "Hello Task!"
Hello Task!
```
</TabItem>
<TabItem value="git-ssh" label="Git over SSH">
```shell
$ task --taskfile git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
task: [hello] echo "Hello Task!"
Hello Task!
```
</TabItem>
</Tabs>
## Including remote Taskfiles
Including a remote file works exactly the same way that including a local file
does. You just need to replace the local path with a remote URI. Any tasks in
the remote Taskfile will be available to run from your main Taskfile.
<Tabs groupId="method" queryString>
<TabItem value="http" label="HTTP/HTTPS">
```yaml
version: '3'
includes:
my-remote-namespace: https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
```
</TabItem>
<TabItem value="git-http" label="Git over HTTP">
```yaml
version: '3'
includes:
my-remote-namespace: https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
```
</TabItem>
<TabItem value="git-ssh" label="Git over SSH">
```yaml
version: '3'
includes:
my-remote-namespace: git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
```
</TabItem>
</Tabs>
```shell
$ task my-remote-namespace:hello
task: [hello] echo "Hello Task!"
Hello Task!
```
### Authenticating using environment variables
The Taskfile location is processed by the templating system, so you can
reference environment variables in your URL if you need to add authentication.
For example:
```yaml
version: '3'
includes:
my-remote-namespace: https://{{.TOKEN}}@raw.githubusercontent.com/my-org/my-repo/main/Taskfile.yml
```
## Security
### Automatic checksums
Running commands from sources that you do not control is always a potential
security risk. For this reason, we have added some automatic checks when using
remote Taskfiles:
1. When running a task from a remote Taskfile for the first time, Task will
print a warning to the console asking you to check that you are sure that you
trust the source of the Taskfile. If you do not accept the prompt, then Task
will exit with code `104` (not trusted) and nothing will run. If you accept
the prompt, the remote Taskfile will run and further calls to the remote
Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of
the file that you are running. If the checksum changes, then Task will print
another warning to the console to inform you that the contents of the remote
file has changed. If you do not accept the prompt, then Task will exit with
code `104` (not trusted) and nothing will run. If you accept the prompt, the
checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an
interactive terminal, so you are not able to accept a prompt. In these cases you
are able to tell task to accept these prompts automatically by using the `--yes`
flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link
containing a commit hash) to prevent Task from automatically accepting a
prompt that says a remote Taskfile has changed.
### Manual checksum pinning
Alternatively, if you expect the contents of your remote files to be a constant
value, you can pin the checksum of the included file instead:
```yaml
version: '3'
includes:
included:
taskfile: https://taskfile.dev
checksum: c153e97e0b3a998a7ed2e61064c6ddaddd0de0c525feefd6bba8569827d8efe9
```
This will disable the automatic checksum prompts discussed above. However, if
the checksums do not match, Task will exit immediately with an error. When
setting this up for the first time, you may not know the correct value of the
checksum. There are a couple of ways you can obtain this:
1. Add the include normally without the `checksum` key. The first time you run
the included Taskfile, a `.task/remote` temporary directory is created. Find
the correct set of files for your included Taskfile and open the file that
ends with `.checksum`. You can copy the contents of this file and paste it
into the `checksum` key of your include. This method is safest as it allows
you to inspect the downloaded Taskfile before you pin it.
2. Alternatively, add the include with a temporary random value in the
`checksum` key. When you try to run the Taskfile, you will get an error that
will report the incorrect expected checksum and the actual checksum. You can
copy the actual checksum and replace your temporary random value.
### TLS
Task currently supports both `http` and `https` URLs. However, the `http`
requests will not execute by default unless you run the task with the
`--insecure` flag. This is to protect you from accidentally running a remote
Taskfile that is downloaded via an unencrypted connection. Sources that are not
protected by TLS are vulnerable to [man-in-the-middle
attacks][man-in-the-middle-attacks] and should be avoided unless you know what
you are doing.
## Caching & Running Offline
Whenever you run a remote Taskfile, the latest copy will be downloaded from the
internet and cached locally. This cached file will be used for all future
invocations of the Taskfile until the cache expires. Once it expires, Task will
download the latest copy of the file and update the cache. By default, the cache
is set to expire immediately. This means that Task will always fetch the latest
version. However, the cache expiry duration can be modified by setting the
`--expiry` flag.
If for any reason you lose access to the internet or you are running Task in
offline mode (via the `--offline` flag or `TASK_OFFLINE` environment variable),
Task will run the any available cached files _even if they are expired_. This
means that you should never be stuck without the ability to run your tasks as
long as you have downloaded a remote Taskfile at least once.
By default, Task will timeout requests to download remote files after 10 seconds
and look for a cached copy instead. This timeout can be configured by setting
the `--timeout` flag and specifying a duration. For example, `--timeout 5s` will
set the timeout to 5 seconds.
By default, the cache is stored in the Task temp directory, represented by the
`TASK_TEMP_DIR` [environment variable](../reference/environment.mdx) You can
override the location of the cache by setting the `TASK_REMOTE_DIR` environment
variable. This way, you can share the cache between different projects.
You can force Task to ignore the cache and download the latest version
by using the `--download` flag.
You can use the `--clear-cache` flag to clear all cached remote files.
{/* prettier-ignore-start */}
[enabling-experiments]: ./experiments.mdx#enabling-experiments
[man-in-the-middle-attacks]: https://en.wikipedia.org/wiki/Man-in-the-middle_attack
[supported-file-names]: https://taskfile.dev/usage/#supported-file-names
[example-remote-taskfile]: https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
{/* prettier-ignore-end */}

View File

@@ -1,143 +0,0 @@
---
slug: /getting-started/
sidebar_position: 3
---
# Getting Started
The following guide will help introduce you to the basics of Task. We'll cover
how to create a Taskfile, how to write a basic task and how to call it. If you
haven't installed Task yet, head over to our [installation
guide][installation].
## Creating your first Taskfile
Once Task is installed, you can create your first Taskfile by running:
```shell
task --init
```
This will create a file called `Taskfile.yml` in the current directory. If you
want to create the file in another directory, you can pass an absolute or
relative path to the directory into the command:
```shell
task --init ./subdirectory
```
Or if you want the Taskfile to have a specific name, you can pass in the name of
the file:
```shell
task --init Custom.yml
```
This will create a Taskfile that looks something like this:
```yaml
version: '3'
vars:
GREETING: Hello, World!
tasks:
default:
cmds:
- echo "{{.GREETING}}"
silent: true
```
As you can see, all Taskfiles are written in [YAML format][yaml]. The `version`
attribute specifies the minimum version of Task that can be used to run this
file. The `vars` attribute is used to define variables that can be used in
tasks. In this case, we are creating a string variable called `GREETING` with a
value of `Hello, World!`.
Finally, the `tasks` attribute is used to define the tasks that can be run. In
this case, we have a task called `default` that echoes the value of the
`GREETING` variable. The `silent` attribute is set to `true`, which means that
the task metadata will not be printed when the task is run - only the output of
the commands.
## Calling a task
To call the task, invoke `task` followed by the name of the task you want to
run. In this case, the name of the task is `default`, so you should run:
```shell
task default
```
Note that we don't have to specify the name of the Taskfile. Task will
automatically look for a file called `Taskfile.yml` (or any of Task's [supported
file names][supported-file-names]) in the current directory. Additionally, tasks
with the name `default` are special. They can also be run without specifying the
task name.
If you created a Taskfile in a different directory, you can run it by passing
the absolute or relative path to the directory as an argument using the `--dir`
flag:
```shell
task --dir ./subdirectory
```
Or if you created a Taskfile with a different name, you can run it by passing
the name of the Taskfile as an argument using the `--taskfile` flag:
```shell
task --taskfile Custom.yml
```
## Adding a build task
Let's create a task to build a program in Go. Start by adding a new task called
`build` below the existing `default` task. We can then add a `cmds` attribute
with a single command to build the program.
Task uses [mvdan/sh][mvdan/sh], a native Go sh interpreter. So you can write
sh/bash-like commands - even in environments where `sh` or `bash` are usually
not available (like Windows). Just remember any executables called must be
available as a built-in or in the system's `PATH`.
When you're done, it should look something like this:
```yaml
version: '3'
vars:
GREETING: Hello, World!
tasks:
default:
cmds:
- echo "{{.GREETING}}"
silent: true
build:
cmds:
- go build ./cmd/main.go
```
Call the task by running:
```shell
task build
```
That's about it for the basics, but there's _so much_ more that you can do with
Task. Check out the rest of the documentation to learn more about all the
features Task has to offer! We recommend taking a look at the [usage
guide][usage] next. Alternatively, you can check out our reference docs for the
[Taskfile schema][schema] and [CLI][cli].
{/* prettier-ignore-start */}
[yaml]: https://yaml.org/
[installation]: /installation/
[supported-file-names]: /usage/#supported-file-names
[mvdan/sh]: https://github.com/mvdan/sh
[usage]: /usage/
[schema]: /reference/schema/
[cli]: /reference/cli/
{/* prettier-ignore-end */}

View File

@@ -1,354 +0,0 @@
---
slug: /installation/
sidebar_position: 2
toc_max_heading_level: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Installation
Task offers many installation methods. Check out the available methods below.
:::info
Some of the methods below are marked as ![Community][community]. This means they
are not maintained by the Task team and may not be up-to-date.
:::
## Package Managers
### [Homebrew][homebrew] ![][macos] ![][linux] \{#homebrew}
Task is available via our official Homebrew tap [[source](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)]:
```shell
brew install go-task/tap/go-task
```
Alternatively it can be installed from the official Homebrew
repository [[package](https://formulae.brew.sh/formula/go-task)]
[[source](https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/go-task.rb)] by running:
```shell
brew install go-task
```
### [Macports][macports] ![][macos] ![][community] \{#macports}
Task repository is tracked by Macports [[package](https://ports.macports.org/port/go-task/details/)] [[source](https://github.com/macports/macports-ports/blob/master/devel/go-task/Portfile)]:
```shell
port install go-task
```
### [Snap][snapcraft] ![][macos] ![][linux] \{#snap}
Task is available on [Snapcraft][snapcraft] [[source](https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml)], but keep in mind that your Linux
distribution should allow classic confinement for Snaps to Task work correctly:
```shell
sudo snap install task --classic
```
### [npm][npm] ![][macos] ![][linux] ![][windows] \{#npm}
Npm can be used as cross-platform way to install Task globally or as a
dependency of your project
[[package](https://www.npmjs.com/package/@go-task/cli)] [[source](https://github.com/go-task/task/blob/main/package.json)]:
```shell
npm install -g @go-task/cli
```
### [pip][pip] ![][macos] ![][linux] ![][windows] ![][community] \{#pip}
Like npm, pip can be used as a cross-platform way to install Task
[[package](https://pypi.org/project/go-task-bin)] [[source](https://github.com/Bing-su/pip-binary-factory/tree/main/task)]:
```shell
pip install go-task-bin
```
### [WinGet][winget] ![][windows] \{#winget}
Task is available via the [community repository](https://github.com/microsoft/winget-pkgs) [[source](https://github.com/microsoft/winget-pkgs/tree/master/manifests/t/Task/Task)]:
```shell
winget install Task.Task
```
### [Chocolatey][choco] ![][windows] ![][community] \{#chocolatey}
[[package](https://community.chocolatey.org/packages/go-task)] [[source](https://github.com/Starz0r/ChocolateyPackagingScripts/blob/master/src/go-task_gh_build.py)]
```shell
choco install go-task
```
### [Scoop][scoop] ![][windows] ![][community] \{#scoop}
[[source](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)]
```shell
scoop install task
```
### Arch ([pacman][pacman]) ![][arch] ![][community] \{#arch}
[[package](https://archlinux.org/packages/extra/x86_64/go-task/)] [[source](https://gitlab.archlinux.org/archlinux/packaging/packages/go-task)]
```shell
pacman -S go-task
```
### Fedora ([dnf][dnf]) ![][fedora] ![][community] \{#fedora}
[[package](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)] [[source](https://src.fedoraproject.org/rpms/golang-github-task)]
```shell
dnf install go-task
```
### FreeBSD ([Ports][freebsdports]) ![][freebsd] ![][community] \{#freebsd}
[[package](https://cgit.freebsd.org/ports/tree/devel/task)] [[source](https://cgit.freebsd.org/ports/tree/devel/task/Makefile)]
```shell
pkg install task
```
### NixOS ([nix][nix]) ![][nixos] ![][linux] ![][community] \{#nix}
[[source](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/go/go-task/package.nix)]
```shell
nix-env -iA nixpkgs.go-task
```
### [pacstall][pacstall] ![][debian] ![][ubuntu] ![][community] \{#pacstall}
[[package](https://pacstall.dev/packages/go-task-deb)] [[source](https://github.com/pacstall/pacstall-programs/blob/master/packages/go-task-deb/go-task-deb.pacscript)]
```shell
pacstall -I go-task-deb
```
### [pkgx][pkgx] ![][macos] ![][linux] ![][community] \{#pkgx}
[[package](https://pkgx.dev/pkgs/taskfile.dev)] [[source](https://github.com/pkgxdev/pantry/blob/main/projects/taskfile.dev/package.yml)]
```shell
pkgx task
```
or, if you have pkgx integration enabled:
```shell
task
```
## Get The Binary
### Binary
You can download the binary from the [releases page on GitHub][releases] and add
to your `$PATH`.
DEB and RPM packages are also available.
The `task_checksums.txt` file contains the SHA-256 checksum for each file.
### Install Script
We also have an [install script][installscript] which is very useful in
scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the
easy generation of this script.
By default, it installs on the `./bin` directory relative to the working
directory:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
```
It is possible to override the installation directory with the `-b` parameter.
On Linux, common choices are `~/.local/bin` and `~/bin` to install for the
current user or `/usr/local/bin` to install for all users:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
```
:::caution
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by
default.
:::
By default, it installs the latest version available.
You can also specify a tag (available in [releases](https://github.com/go-task/task/releases))
to install a specific version:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d v3.36.0
```
Parameters are order specific, to set both installation directory and version:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin v3.42.1
```
### GitHub Actions
If you want to install Task in GitHub Actions you can try using
[this action](https://github.com/arduino/setup-task) by the Arduino team:
```yaml
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
```
This installation method is community owned.
## Build From Source
### Go Modules
Ensure that you have a supported version of [Go][go] properly installed and
setup. You can find the minimum required version of Go in the
[go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file.
You can then install the latest release globally by running:
```shell
go install github.com/go-task/task/v3/cmd/task@latest
```
Or you can install into another directory:
```shell
env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
```
:::tip
For CI environments we recommend using the [install script](#install-script)
instead, which is faster and more stable, since it'll just download the latest
released binary.
:::
## Setup completions
Some installation methods will automatically install completions too, but if
this isn't working for you or your chosen method doesn't include them, you can
run `task --completion <shell>` to output a completion script for any supported
shell. There are a couple of ways these completions can be added to your shell
config:
### Option 1. Load the completions in your shell's startup config (Recommended)
This method loads the completion script from the currently installed version of
task every time you create a new shell. This ensures that your completions are
always up-to-date.
<Tabs values={[ {label: 'bash', value: '1'}, {label: 'zsh', value: '2'},
{label: 'fish', value: '3'},
{label: 'powershell', value: '4'}
]}>
<TabItem value="1">
```shell title="~/.bashrc"
eval "$(task --completion bash)"
```
</TabItem>
<TabItem value="2">
```shell title="~/.zshrc"
eval "$(task --completion zsh)"
```
</TabItem>
<TabItem value="3">
```shell title="~/.config/fish/config.fish"
task --completion fish | source
```
</TabItem>
<TabItem value="4">
```powershell title="$PROFILE\Microsoft.PowerShell_profile.ps1"
Invoke-Expression (&task --completion powershell | Out-String)
```
</TabItem></Tabs>
### Option 2. Copy the script to your shell's completions directory
This method requires you to manually update the completions whenever Task is
updated. However, it is useful if you want to modify the completions yourself.
<Tabs
values={[
{label: 'bash', value: '1'},
{label: 'zsh', value: '2'},
{label: 'fish', value: '3'}
]}>
<TabItem value="1">
```shell
task --completion bash > /etc/bash_completion.d/task
```
</TabItem>
<TabItem value="2">
```shell
task --completion zsh > /usr/local/share/zsh/site-functions/_task
```
</TabItem>
<TabItem value="3">
```shell
task --completion fish > ~/.config/fish/completions/task.fish
```
</TabItem></Tabs>
{/* prettier-ignore-start */}
[homebrew]: https://brew.sh
[macports]: https://macports.org
[snapcraft]: https://snapcraft.io/task
[winget]: https://github.com/microsoft/winget-cli
[choco]: https://chocolatey.org
[scoop]: https://scoop.sh
[pacman]: https://wiki.archlinux.org/title/Pacman
[dnf]: https://docs.fedoraproject.org/en-US/quick-docs/dnf
[nix]: https://nixos.org
[npm]: https://www.npmjs.com
[pip]: https://pip.pypa.io
[mise]: https://mise.jdx.dev
[aqua]: https://aquaproj.github.io
[pacstall]: https://github.com/pacstall/pacstall
[pkgx]: https://pkgx.sh
[freebsdports]: https://ports.freebsd.org/cgi/ports.cgi
[go]: https://golang.org
[godownloader]: https://github.com/goreleaser/godownloader
[releases]: https://github.com/go-task/task/releases
[installscript]: https://github.com/go-task/task/blob/main/install-task.sh
[community]: https://img.shields.io/badge/Community%20Owned-orange
[windows]: https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white
[macos]: https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0
[linux]: https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black
[arch]: https://img.shields.io/badge/Arch%20Linux-1793D1?logo=arch-linux&logoColor=fff
[fedora]: https://img.shields.io/badge/Fedora-51A2DA?logo=fedora&logoColor=fff
[nixos]: https://img.shields.io/badge/NixOS-5277C3?logo=nixos&logoColor=fff
[debian]: https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=fff
[ubuntu]: https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=fff
[freebsd]: https://img.shields.io/badge/FreeBSD-990000?logo=freebsd&logoColor=fff
{/* prettier-ignore-end */}

View File

@@ -1,84 +0,0 @@
---
slug: /integrations/
sidebar_position: 9
---
# Integrations
## Visual Studio Code Extension
Task has an
[official extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=task.vscode-task).
The code for this project can be found
[here](https://github.com/go-task/vscode-task). To use this extension, you must
have Task v3.23.0+ installed on your system.
This extension provides the following features (and more):
- View tasks in the sidebar.
- Run tasks from the sidebar and command palette.
- Go to definition from the sidebar and command palette.
- Run last task command.
- Multi-root workspace support.
- Initialize a Taskfile in the current workspace.
To get autocompletion and validation for your Taskfile, see the
[Schema](#schema) section below.
![Task for Visual Studio Code](https://github.com/go-task/vscode-task/blob/main/res/preview.png?raw=true)
## Schema
This was initially created by @KROSF in
[this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895) and
is now officially maintained in
[this file](https://github.com/go-task/task/blob/main/website/static/schema.json)
and made available at https://taskfile.dev/schema.json. This schema can be used
to validate Taskfiles and provide autocompletion in many code editors:
### Visual Studio Code
To integrate the schema into VS Code, you need to install the
[YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)
by Red Hat. Any `Taskfile.yml` in your project should automatically be detected
and validation/autocompletion should work. If this doesn't work or you want to
manually configure it for files with a different name, you can add the following
to your `settings.json`:
```json
// settings.json
{
"yaml.schemas": {
"https://taskfile.dev/schema.json": [
"**/Taskfile.yml",
"./path/to/any/other/taskfile.yml"
]
}
}
```
You can also configure the schema directly inside of a Taskfile by adding the
following comment to the top of the file:
```yaml
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
```
You can find more information on this in the
[YAML language server project](https://github.com/redhat-developer/yaml-language-server).
## Community Integrations
In addition to our official integrations, there is an amazing community of
developers who have created their own integrations for Task:
- [Sublime Text Plugin](https://packagecontrol.io/packages/Taskfile)
[[source](https://github.com/biozz/sublime-taskfile)] by @biozz
- [IntelliJ Plugin](https://plugins.jetbrains.com/plugin/17058-taskfile)
[[source](https://github.com/lechuckroh/task-intellij-plugin)] by @lechuckroh
- [mk](https://github.com/pycontribs/mk) command line tool recognizes Taskfiles
natively.
If you have made something that integrates with Task, please feel free to open a
PR to add it to this list.

View File

@@ -1,68 +0,0 @@
---
slug: /
sidebar_position: 1
title: Home
hide_title: true
---
<div align="center">
<img id="logo" src="/img/logo.svg" height="250px" width="250px" />
</div>
<br />
Task is a task runner / build tool that aims to be simpler and easier to use
than, for example, [GNU Make][make].
Since it's written in [Go][go], Task is just a single binary and has no other
dependencies, which means you don't need to mess with any complicated install
setups just to use a build tool.
## Features
- [Easy installation](/installation): just download a single binary, add to
`$PATH` and you're done! Or you can also install using [Homebrew][homebrew],
[Snapcraft][snapcraft], or [Scoop][scoop] if you want.
- Available on CIs: by adding
[this simple command](/installation#install-script) to install on your CI
script and you're ready to use Task as part of your CI pipeline;
- Truly cross-platform: while most build tools only work well on Linux or macOS,
Task also supports Windows thanks to [this shell interpreter for Go][sh].
- Great for code generation: you can easily
[prevent a task from running](/usage#prevent-unnecessary-work) if a given set
of files haven't changed since last run (based either on its timestamp or
content).
## Documentation
- If you're new to Task, we recommend taking a look at our [getting started
guide][getting-started] for an quick introduction.
- You can also browse our [usage documentation][usage] for more details on how
all the features work.
- Or use our quick reference documentation for the [Taskfile schema][schema] or
[CLI][cli].
## Gold Sponsors
<table class="gold-sponsors">
<tr>
<td align="center" valign="middle">
<a target="_blank" href="https://devowl.io">
<img src="/img/devowl.io.svg" height="100px" title="devowl.io" />
</a>
</td>
</tr>
</table>
{/* prettier-ignore-start */}
[make]: https://www.gnu.org/software/make/
[go]: https://go.dev/
[yaml]: http://yaml.org/
[homebrew]: https://brew.sh/
[snapcraft]: https://snapcraft.io/
[scoop]: https://scoop.sh/
[sh]: https://github.com/mvdan/sh
[getting-started]: /getting-started/
[usage]: /usage/
[schema]: /reference/schema/
[cli]: /reference/cli/
{/* prettier-ignore-end */}

View File

@@ -1,2 +0,0 @@
position: 5
label: Reference

View File

@@ -1,121 +0,0 @@
---
slug: /reference/cli
sidebar_position: 1
---
# CLI Reference
Task CLI commands have the following syntax:
```shell
task [--flags] [tasks...] [-- CLI_ARGS...]
```
:::tip
If `--` is given, all remaining arguments will be assigned to a special
`CLI_ARGS` variable
:::
## Flags
| Short | Flag | Type | Default | Description |
| ----- | --------------------------- | -------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-c` | `--color` | `bool` | `true` | Colored output. Enabled by default. Set flag to `false` or use `NO_COLOR=1` to disable. |
| `-C` | `--concurrency` | `int` | `0` | Limit number tasks to run concurrently. Zero means unlimited. |
| `-d` | `--dir` | `string` | Working directory | Sets the directory in which Task will execute and look for a Taskfile. |
| `-n` | `--dry` | `bool` | `false` | Compiles and prints tasks in the order that they would be run, without executing them. |
| `-x` | `--exit-code` | `bool` | `false` | Pass-through the exit code of the task command. |
| `-f` | `--force` | `bool` | `false` | Forces execution even when the task is up-to-date. |
| `-g` | `--global` | `bool` | `false` | Runs global Taskfile, from `$HOME/Taskfile.{yml,yaml}`. |
| `-h` | `--help` | `bool` | `false` | Shows Task usage. |
| `-i` | `--init` | `bool` | `false` | Creates a new Taskfile.yml in the current folder. |
| `-I` | `--interval` | `string` | `5s` | Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid [Go Duration](https://pkg.go.dev/time#ParseDuration). |
| `-l` | `--list` | `bool` | `false` | Lists tasks with description of current Taskfile. |
| `-a` | `--list-all` | `bool` | `false` | Lists tasks with or without a description. |
| | `--sort` | `string` | `default` | Changes the order of the tasks when listed.<br />`default` - Alphanumeric with root tasks first<br />`alphanumeric` - Alphanumeric<br />`none` - No sorting (As they appear in the Taskfile) |
| | `--json` | `bool` | `false` | See [JSON Output](#json-output) |
| `-o` | `--output` | `string` | Default set in the Taskfile or `interleaved` | Sets output style: [`interleaved`/`group`/`prefixed`]. |
| | `--output-group-begin` | `string` | | Message template to print before a task's grouped output. |
| | `--output-group-end` | `string` | | Message template to print after a task's grouped output. |
| | `--output-group-error-only` | `bool` | `false` | Swallow command output on zero exit code. |
| `-p` | `--parallel` | `bool` | `false` | Executes tasks provided on command line in parallel. |
| `-s` | `--silent` | `bool` | `false` | Disables echoing. |
| `-y` | `--yes` | `bool` | `false` | Assume "yes" as answer to all prompts. |
| | `--status` | `bool` | `false` | Exits with non-zero exit code if any of the given tasks is not up-to-date. |
| | `--summary` | `bool` | `false` | Show summary about a task. |
| `-t` | `--taskfile` | `string` | | Taskfile path to run.<br />Check the list of default filenames [here](../usage/#supported-file-names). |
| `-v` | `--verbose` | `bool` | `false` | Enables verbose mode. |
| | `--version` | `bool` | `false` | Show Task version. |
| `-w` | `--watch` | `bool` | `false` | Enables watch of the given task.
## Exit Codes
Task will sometimes exit with specific exit codes. These codes are split into
four groups with the following ranges:
- Success (0)
- General errors (1-99)
- Taskfile errors (100-199)
- Task errors (200-255)
A full list of the exit codes and their descriptions can be found below:
| Code | Description |
|------|---------------------------------------------------------------------|
| 0 | Success |
| 1 | An unknown error occurred |
| 100 | No Taskfile was found |
| 101 | A Taskfile already exists when trying to initialize one |
| 102 | The Taskfile is invalid or cannot be parsed |
| 103 | A remote Taskfile could not be downloaded |
| 104 | A remote Taskfile was not trusted by the user |
| 105 | A remote Taskfile was could not be fetched securely |
| 106 | No cache was found for a remote Taskfile in offline mode |
| 107 | No schema version was defined in the Taskfile |
| 200 | The specified task could not be found |
| 201 | An error occurred while executing a command inside of a task |
| 202 | The user tried to invoke a task that is internal |
| 203 | There a multiple tasks with the same name or alias |
| 204 | A task was called too many times |
| 205 | A task was cancelled by the user |
| 206 | A task was not executed due to missing required variables |
| 207 | A task was not executed due to a variable having an incorrect value |
These codes can also be found in the repository in
[`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
:::info
When Task is run with the `-x`/`--exit-code` flag, the exit code of any failed
commands will be passed through to the user instead.
:::
## JSON Output
When using the `--json` flag in combination with either the `--list` or
`--list-all` flags, the output will be a JSON object with the following
structure:
```json
{
"tasks": [
{
"name": "",
"task": "",
"desc": "",
"summary": "",
"up_to_date": false,
"location": {
"line": 54,
"column": 3,
"taskfile": "/path/to/Taskfile.yml"
}
}
// ...
],
"location": "/path/to/Taskfile.yml"
}
```

View File

@@ -1,49 +0,0 @@
---
slug: /reference/environment
sidebar_position: 5
---
# Environment Reference
Task allows you to configure some behavior using environment variables. This
page lists all the environment variables that Task supports.
| ENV | Default | Description |
|-------------------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `TASK_TEMP_DIR` | `.task` | Location of the temp dir. Can relative to the project like `tmp/task` or absolute like `/tmp/.task` or `~/.task`. |
| `TASK_REMOTE_DIR` | `TASK_TEMP_DIR` | Location of the remote temp dir (used for caching). Can relative to the project like `tmp/task` or absolute like `/tmp/.task` or `~/.task`. |
| `TASK_OFFLINE` | `false` | Set the `--offline` flag through the environment variable. Only for remote experiment. CLI flag `--offline` takes precedence over the env variable |
| `FORCE_COLOR` | | Force color output usage. |
## Custom Colors
| ENV | Default | Description |
|-----------------------------|---------|-------------------------|
| `TASK_COLOR_RESET` | `0` | Color used for white. |
| `TASK_COLOR_RED` | `31` | Color used for red. |
| `TASK_COLOR_GREEN` | `32` | Color used for green. |
| `TASK_COLOR_YELLOW` | `33` | Color used for yellow. |
| `TASK_COLOR_BLUE` | `34` | Color used for blue. |
| `TASK_COLOR_MAGENTA` | `35` | Color used for magenta. |
| `TASK_COLOR_CYAN` | `36` | Color used for cyan. |
| `TASK_COLOR_BRIGHT_RED` | `91` | Color used for red. |
| `TASK_COLOR_BRIGHT_GREEN` | `92` | Color used for green. |
| `TASK_COLOR_BRIGHT_YELLOW` | `93` | Color used for yellow. |
| `TASK_COLOR_BRIGHT_BLUE` | `94` | Color used for blue. |
| `TASK_COLOR_BRIGHT_MAGENTA` | `95` | Color used for magenta. |
| `TASK_COLOR_BRIGHT_CYAN` | `96` | Color used for cyan. |
All color variables are [ANSI color codes][ansi]. You can specify multiple codes
separated by a semicolon. For example: `31;1` will make the text bold and red.
Task also supports 8-bit color (256 colors). You can specify these colors by
using the sequence `38;2;R:G:B` for foreground colors and `48;2;R:G:B` for
background colors where `R`, `G` and `B` should be replaced with values between
0 and 255.
For convenience, we allow foreground colors to be specified using shorthand,
comma-separated syntax: `R,G,B`. For example, `255,0,0` is equivalent to
`38;2;255:0:0`.
{/* prettier-ignore-start */}
[ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code
{/* prettier-ignore-end */}

View File

@@ -1,242 +0,0 @@
---
slug: /reference/schema
sidebar_position: 3
toc_min_heading_level: 2
toc_max_heading_level: 5
---
# Schema Reference
| Attribute | Type | Default | Description |
|------------|------------------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `version` | `string` | | Version of the Taskfile. The current version is `3`. |
| `output` | `string` | `interleaved` | Output mode. Available options: `interleaved`, `group` and `prefixed`. |
| `method` | `string` | `checksum` | Default method in this Taskfile. Can be overridden in a task by task basis. Available options: `checksum`, `timestamp` and `none`. |
| `includes` | [`map[string]Include`](#include) | | Additional Taskfiles to be included. |
| `vars` | [`map[string]Variable`](#variable) | | A set of global variables. |
| `env` | [`map[string]Variable`](#variable) | | A set of global environment variables. |
| `tasks` | [`map[string]Task`](#task) | | A set of task definitions. |
| `silent` | `bool` | `false` | Default 'silent' options for this Taskfile. If `false`, can be overridden with `true` in a task by task basis. |
| `dotenv` | `[]string` | | A list of `.env` file paths to be parsed. |
| `run` | `string` | `always` | Default 'run' option for this Taskfile. Available options: `always`, `once` and `when_changed`. |
| `interval` | `string` | `5s` | Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid [Go Duration](https://pkg.go.dev/time#ParseDuration). |
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
## Include
| Attribute | Type | Default | Description |
|------------|-----------------------|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `taskfile` | `string` | | The path for the Taskfile or directory to be included. If a directory, Task will look for files named `Taskfile.yml` or `Taskfile.yaml` inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile. |
| `dir` | `string` | The parent Taskfile directory | The working directory of the included tasks when run. |
| `optional` | `bool` | `false` | If `true`, no errors will be thrown if the specified file does not exist. |
| `flatten` | `bool` | `false` | If `true`, the tasks from the included Taskfile will be available in the including Taskfile without a namespace. If a task with the same name already exists in the including Taskfile, an error will be thrown. |
| `internal` | `bool` | `false` | Stops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with `--list`. |
| `aliases` | `[]string` | | Alternative names for the namespace of the included Taskfile. |
| `vars` | `map[string]Variable` | | A set of variables to apply to the included Taskfile. |
| `checksum` | `string` | | The checksum of the file you expect to include. If the checksum does not match, the file will not be included. |
:::info
Informing only a string like below is equivalent to setting that value to the
`taskfile` attribute.
```yaml
includes:
foo: ./path
```
:::
## Variable
| Attribute | Type | Default | Description |
| --------- | -------- | ------- | ------------------------------------------------------------------------ |
| _itself_ | `string` | | A static value that will be set to the variable. |
| `sh` | `string` | | A shell command. The output (`STDOUT`) will be assigned to the variable. |
:::info
Static and dynamic variables have different syntaxes, like below:
```yaml
vars:
STATIC: static
DYNAMIC:
sh: echo "dynamic"
```
:::
:::info
In a variables map, variables defined later may reference variables defined
earlier (declaration order is respected):
```yaml
vars:
FIRST_VAR: "hello"
SECOND_VAR: "{{.FIRST_VAR}} world"
```
:::
## Task
| Attribute | Type | Default | Description |
| --------------- | ---------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cmds` | [`[]Command`](#command) | | A list of shell commands to be executed. |
| `deps` | [`[]Dependency`](#dependency) | | A list of dependencies of this task. Tasks defined here will run in parallel before this task. |
| `label` | `string` | | Overrides the name of the task in the output when a task is run. Supports variables. |
| `desc` | `string` | | A short description of the task. This is displayed when calling `task --list`. |
| `prompt` | `[]string` | | One or more prompts that will be presented before a task is run. Declining will cancel running the current and any subsequent tasks. |
| `summary` | `string` | | A longer description of the task. This is displayed when calling `task --summary [task]`. |
| `aliases` | `[]string` | | A list of alternative names by which the task can be called. |
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
| `dotenv` | `[]string` | | A list of `.env` file paths to be parsed. |
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. When combined with the `--list` flag, task descriptions will be hidden. |
| `interactive` | `bool` | `false` | Tells task that the command is interactive. |
| `internal` | `bool` | `false` | Stops a task from being callable on the command line. It will also be omitted from the output when used with `--list`. |
| `method` | `string` | `checksum` | Defines which method is used to check the task is up-to-date. `timestamp` will compare the timestamp of the sources and generates files. `checksum` will check the checksum (You probably want to ignore the .task folder in your .gitignore file). `none` skips any validation and always run the task. |
| `prefix` | `string` | | Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`. |
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing commands. |
| `run` | `string` | The one declared globally in the Taskfile or `always` | Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`. |
| `platforms` | `[]string` | All platforms | Specifies which platforms the task should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go). Task will be skipped otherwise. |
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
:::info
These alternative syntaxes are available. They will set the given values to
`cmds` and everything else will be set to their default values:
```yaml
tasks:
foo: echo "foo"
foobar:
- echo "foo"
- echo "bar"
baz:
cmd: echo "baz"
```
:::
### Command
| Attribute | Type | Default | Description |
| -------------- | ---------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cmd` | `string` | | The shell command to be executed. |
| `task` | `string` | | Set this to trigger execution of another task instead of running a command. This cannot be set together with `cmd`. |
| `for` | [`For`](#for) | | Runs the command once for each given value. |
| `silent` | `bool` | `false` | Skips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected. |
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the referenced task. Only relevant when setting `task` instead of `cmd`. |
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing the command. |
| `defer` | [`Defer`](#defer) | | Alternative to `cmd`, but schedules the command or a task to be executed at the end of this task instead of immediately. This cannot be used together with `cmd`. |
| `platforms` | `[]string` | All platforms | Specifies which platforms the command should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go). Command will be skipped otherwise. |
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
:::info
If given as a a string, the value will be assigned to `cmd`:
```yaml
tasks:
foo:
cmds:
- echo "foo"
- echo "bar"
```
:::
### Dependency
| Attribute | Type | Default | Description |
| --------- | ---------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
| `task` | `string` | | The task to be execute as a dependency. |
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to this task. |
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. |
:::tip
If you don't want to set additional variables, it's enough to declare the
dependency as a list of strings (they will be assigned to `task`):
```yaml
tasks:
foo:
deps: [foo, bar]
```
:::
### Defer
The `defer` parameter defines a shell command to run, or a task to trigger, at the end of the current task instead of immediately.
If defined as a string this is a shell command, otherwise it is a map defining a task to call:
| Attribute | Type | Default | Description |
| --------- | ---------------------------------- | ------- | ----------------------------------------------------------------- |
| `task` | `string` | | The deferred task to trigger. |
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the deferred task. |
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. |
### For
The `for` parameter can be defined as a string, a list of strings or a map. If
it is defined as a string, you can give it any of the following values:
- `sources` - Will run the command for each source file defined on the task.
(Glob patterns will be resolved, so `*.go` will run for every Go file that
matches).
- `generates` - Will run the command for each file defined in the task's generates
list. (Glob patterns will be resolved, so `*.txt` will run for every text file
that matches).
If it is defined as a list of strings, the command will be run for each value.
Finally, the `for` parameter can be defined as a map when you want to use a
variable to define the values to loop over:
| Attribute | Type | Default | Description |
| --------- | -------- | ---------------- | -------------------------------------------- |
| `var` | `string` | | The name of the variable to use as an input. |
| `split` | `string` | (any whitespace) | What string the variable should be split on. |
| `as` | `string` | `ITEM` | The name of the iterator variable. |
### Precondition
| Attribute | Type | Default | Description |
| --------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| `sh` | `string` | | Command to be executed. If a non-zero exit code is returned, the task errors without executing its commands. |
| `msg` | `string` | | Optional message to print if the precondition isn't met. |
:::tip
If you don't want to set a different message, you can declare a precondition
like this and the value will be assigned to `sh`:
```yaml
tasks:
foo:
precondition: test -f Taskfile.yml
```
:::
### Requires
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |

View File

@@ -1,426 +0,0 @@
---
slug: /reference/templating/
sidebar_position: 4
toc_min_heading_level: 2
toc_max_heading_level: 5
---
# Templating Reference
Task's templating engine uses Go's [text/template][text/template] package to
interpolate values. For detailed information about the usage of Go's templating
engine, we recommend reading [the official documentation][text/template].
However, we will provide a basic overview of the main features here.
## Basic Usage
Most string values in Task (though, not all) can be templated. The templating
engine uses double curly braces `{{` and `}}` to denote a template. Anything
inside the curly braces will be executed as a Go template and the result will be
inserted into the resulting string. For example:
```yaml
version: '3'
tasks:
hello:
vars:
MESSAGE: 'Hello, World!'
cmds:
- 'echo {{.MESSAGE}}'
```
In this example, we have a task called `hello` with a single variable, `MESSAGE`
defined. When the command is run, the templating engine will evaluate the
variable and replace `{{.MESSAGE}}` with the variable's contents. This task will
output `Hello, World!` to the terminal. Note that when referring to a variable,
you must use dot notation.
You are also able to do more complex things in templates, such as conditional
logic:
```yaml
version: '3'
tasks:
maybe-happy:
vars:
SMILE: ':\)'
FROWN: ':\('
HAPPY: true
cmds:
- 'echo {{if .HAPPY}}{{.SMILE}}{{else}}{{.FROWN}}{{end}}'
```
```txt
:)
```
...calling functions and piping values:
```yaml
version: '3'
tasks:
uniq:
vars:
NUMBERS: '0,1,1,1,2,2,3'
cmds:
- 'echo {{splitList "," .NUMBERS | uniq | join ", " }}!'
```
```txt
0, 1, 2, 3
```
...looping over values with control flow operators:
```yaml
version: '3'
tasks:
loop:
vars:
NUMBERS: [0, 1, 1, 1, 2, 2, 3]
cmds:
# Ranges over NUMBERS and prints the index and value of each number until it finds a number greater than 1
- "{{range $index, $num := .NUMBERS}}{{if gt $num 1 }}{{break}}{{end}}echo {{$index}}: {{$num}}\n{{end}}"
```
```txt
0: 0
1: 1
2: 1
3: 1
```
## Special Variables
Task defines some special variables that are always available to the templating
engine. If you define a variable with the same name as a special variable, the
special variable will be overridden.
| Var | Description |
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `CLI_ARGS` | Contain all extra arguments passed after `--` when calling Task through the CLI as a string. |
| `CLI_ARGS_LIST` | Contain all extra arguments passed after `--` when calling Task through the CLI as a shell parsed list. |
| `CLI_FORCE` | A boolean containing whether the `--force` or `--force-all` flags were set. |
| `CLI_SILENT` | A boolean containing whether the `--silent` flag was set. |
| `CLI_VERBOSE` | A boolean containing whether the `--verbose` flag was set. |
| `CLI_OFFLINE` | A boolean containing whether the `--offline` flag was set. |
| `TASK` | The name of the current task. |
| `ALIAS` | The alias used for the current task, otherwise matches `TASK`. |
| `TASK_EXE` | The Task executable name or path. |
| `ROOT_TASKFILE` | The absolute path of the root Taskfile. |
| `ROOT_DIR` | The absolute path of the root Taskfile directory. |
| `TASKFILE` | The absolute path of the included Taskfile. |
| `TASKFILE_DIR` | The absolute path of the included Taskfile directory. |
| `TASK_DIR` | The absolute path of the directory where the task is executed. |
| `USER_WORKING_DIR` | The absolute path of the directory `task` was called from. |
| `CHECKSUM` | The checksum of the files listed in `sources`. Only available within the `status` prop and if method is set to `checksum`. |
| `TIMESTAMP` | The date object of the greatest timestamp of the files listed in `sources`. Only available within the `status` prop and if method is set to `timestamp`. |
| `TASK_VERSION` | The current version of task. |
| `ITEM` | The value of the current iteration when using the `for` property. Can be changed to a different variable name using `as:`. |
| `EXIT_CODE` | Available exclusively inside the `defer:` command. Contains the failed command exit code. Only set when non-zero. |
## Functions
Functions are provided at a few different levels in Task. Below, we list all the
functions available for use in Task.
:::note
Functions marked with an asterisk (\*) also have `must` variants that will panic
rather than erroring.
:::
### Built-in Functions
The first set of functions are [provided by Golang
itself][go-template-functions]:
| Function | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `and` | Returns the boolean AND of its arguments by returning the first empty argument or the last argument. That is, `and x y` behaves as `if x then y else x`. Evaluation proceeds through the arguments left to right and returns when the result is determined. |
| `call` | Returns the result of calling the first argument, which must be a function, with the remaining arguments as parameters. Thus `call .X.Y 1 2` is, in Go notation, `dot.X.Y(1, 2)` where `Y` is a func-valued field, map entry, or the like. The first argument must be the result of an evaluation that yields a value of function type (as distinct from a predefined function such as print). The function must return either one or two result values, the second of which is of type error. If the arguments don't match the function or the returned error value is non-nil, execution stops. |
| `html` | Returns the escaped HTML equivalent of the textual representation of its arguments. This function is unavailable in [html/template][html/template], with a few exceptions. |
| `index` | Returns the result of indexing its first argument by the following arguments. Thus `index x 1 2 3` is, in Go syntax, `x[1][2][3]`. Each indexed item must be a map, slice, or array. |
| `slice` | slice returns the result of slicing its first argument by the remaining arguments. Thus `slice x 1 2` is, in Go syntax, `x[1:2]`, while `slice x` is `x[:]`, `slice x 1` is `x[1:]`, and `slice x 1 2 3` is `x[1:2:3]`. The first argument must be a string, slice, or array. |
| `js` | Returns the escaped JavaScript equivalent of the textual representation of its arguments. |
| `len` | Returns the integer length of its argument. |
| `not` | Returns the boolean negation of its single argument. |
| `or` | Returns the boolean OR of its arguments by returning the first non-empty argument or the last argument, that is, `or x y` behaves as `if x then x else y`. Evaluation proceeds through the arguments left to right and returns when the result is determined. |
| `print` | An alias for `fmt.Sprint`. |
| `printf` | An alias for `fmt.Sprintf`. |
| `println` | An alias for `fmt.Sprintln`. |
| `urlquery` | Returns the escaped value of the textual representation of its arguments in a form suitable for embedding in a URL query. This function is unavailable in [html/template][html/template], with a few exceptions. |
### Slim-Sprig Functions
In addition to the built-in functions, Task also provides a set of functions
imported via the [slim-sprig][slim-sprig] package. We only provide a very basic
description here for completeness. For detailed usage, please refer to the
[slim-sprig documentation][slim-sprig]:
#### [String Functions][string-functions]
| Function | Description |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `trim` | Removes space from either side of a string. |
| `trimAll` | Removes given characters from the front or back of a string. |
| `trimSuffix` | Trims just the suffix from a string. |
| `trimPrefix` | Trims just the prefix from a string. |
| `upper` | Converts the entire string to uppercase. |
| `lower` | Converts the entire string to lowercase. |
| `title` | Converts to title case. |
| `repeat` | Repeats a string multiple times. |
| `substr` | Gets a substring from a string. |
| `trunc` | Truncates a string. |
| `contains` | Tests to see if one string is contained inside of another. |
| `hasPrefix` | Tests whether a string has a given prefix. |
| `hasSuffix` | Tests whether a string has a given suffix. |
| `quote` | Wraps a string in double quotes. |
| `squote` | Wraps a string in single quotes. |
| `cat` | Concatenates multiple strings together into one, separating them with spaces. |
| `indent` | Indents every line in a given string to the specified indent width. |
| `nindent` | Identical to `indent`, but prepends a new line to the beginning of the string. |
| `replace` | Replaces a string. |
| `plural` | Pluralizes a string. |
| `regexMatch`\* | Returns true if the input string contains any match of the regular expression. |
| `regexFindAll`\* | Returns a slice of all matches of the regular expression in the input string. |
| `regexFind`\* | Returns the first (left most) match of the regular expression in the input string. |
| `regexReplaceAll`\* | Returns a copy of the input string, replacing matches of the Regexp with the replacement string replacement. |
| `regexReplaceAllLiteral`\* | Returns a copy of the input string, replacing matches of the Regexp with the replacement string replacement without expanding `$`. |
| `regexSplit`\* | Slices the input string into substrings separated by the expression and returns a slice of the substrings between those expression matches. |
| `regexQuoteMeta`\* | Returns a string that escapes all regular expression metacharacters inside the argument text. |
#### [String Slice Functions][string-list-functions]
| Function | Description |
| ----------- | ----------------------------------------------------------------------- |
| `join` | Joins a list of strings into a single string, with the given separator. |
| `splitList` | Splits a string into a list of strings. |
| `split` | Splits a string into a map of strings where each key is an index. |
| `splitn` | Identical to `split`, but stops splitting after `n` values. |
| `sortAlpha` | Sorts a list of strings into alphabetical (lexicographical) order. |
#### [Integer Functions][math-functions]
| Function | Description |
| --------- | ------------------------------------------------------------------------------------------------------- |
| `add` | Sum a set of numbers. |
| `add1` | Increments a number by 1. |
| `sub` | Subtracts one number from another. |
| `div` | Performs integer division. |
| `mod` | Modulo. |
| `mul` | Multiplies a set of numbers. |
| `max` | Returns the largest of a set of integers. |
| `min` | Returns the smallest of a set of integers. |
| `floor` | Returns the greatest float value less than or equal to input value |
| `ceil` | Returns the greatest float value greater than or equal to input value |
| `round` | Returns a float value with the remainder rounded to the given number to digits after the decimal point. |
| `randInt` | Returns a random integer value from min (inclusive) to max (exclusive). |
#### [Integer Slice Functions][integer-list-functions]
| Function | Description |
| ----------- | --------------------------------------------------------------------------- |
| `until` | Builds a range of integers. |
| `untilStep` | Builds a range of integers, but allows you to define a start, stop and step |
| `seq` | Works like the bash `seq` command. |
#### [Date Functions][date-functions]
| Function | Description |
| ---------------- | ------------------------------------------------------------------------------ |
| `now` | Gets the current date/time. |
| `ago` | Returns the duration since the given date/time. |
| `date` | Formats a date. |
| `dateInZone` | Identical to `date`, but with the given timezone. |
| `duration` | Formats the number of seconds into a string. |
| `durationRound` | Identical to `duration`, but rounds the duration to the most significant unit. |
| `unixEpoch` | Returns the seconds since the unix epoch for the given date/time. |
| `dateModify`\* | Modifies a date using the given input string. |
| `htmlDate` | Formats a date for inserting into an HTML date picker input field. |
| `htmlDateInZone` | Identical to `htmlDate`, but with the given timezone. |
| `toDate`\* | Converts a string to a date/time. |
#### [Default Functions][default-functions]
| Function | Description |
| ---------- | ------------------------------------------------------------------------ |
| `default` | Uses a default value if the given value is considered "zero" or "empty". |
| `empty` | Returns true if a value is considered "zero" or "empty". |
| `coalesce` | Takes a list of values and returns the first non-empty one. |
| `all` | Returns true if all values are non-empty. |
| `any` | Returns true if any value is non-empty. |
| `ternary` | The ternary function takes two values, and a test value. If the test value is true, the first value will be returned. If the test value is empty, the second value will be returned. |
#### [Encoding Functions][encoding-functions]
| Function | Description |
| ---------------- | ------------------------------------------------------------------ |
| `fromJson`\* | Decodes a JSON string into an object. |
| `toJson`\* | Encodes an object as a JSON string. |
| `toPrettyJson`\* | Encodes an object as a JSON string with new lines and indentation. |
| `toRawJson`\* | Encodes an object as a JSON string with HTML characters unescaped. |
| `b64enc` | Encodes a string into base 64. |
| `b64dec` | Decodes a string from base 64. |
| `b32enc` | Encodes a string into base 32. |
| `b32dec` | Decodes a string from base 32. |
:::note
YAML encoding functions are [provided directly by Task](#task-functions).
:::
#### [List Functions][list-functions]
| Function | Description |
| ----------- | ---------------------------------------------------------------- |
| `list` | Creates a list from a set of values. |
| `first`\* | Gets the first value in a list. |
| `rest`\* | Gets all values except the first value in the list. |
| `last`\* | Gets the last value in the list. |
| `initial`\* | Get all values except the last value in the list. |
| `append`\* | Adds a new value to the end of the list. |
| `prepend`\* | Adds a new value to the start of the list. |
| `concat` | Joins two or more lists together. |
| `reverse`\* | Reverses the order of a list. |
| `uniq`\* | Generate a list with all of the duplicates removed. |
| `without`\* | Filters matching items out of a list. |
| `has`\* | Tests to see if a list has a particular element. |
| `compact`\* | Removes entries with empty values. |
| `slice`\* | Returns a partial copy of a list given start and end parameters. |
| `chunk` | Splits a list into chunks of given size. |
#### [Dictionary Functions][dictionary-functions]
| Function | Description |
| ------------------ | ------------------------------------------------------------------------------------------ |
| `dict` | Creates a dictionary from a set of key/value pairs. |
| `get` | Gets the value from the dictionary with the given key. |
| `set` | Adds a new key/value pair to a dictionary. |
| `unset` | Deletes a key from a dictionary. |
| `hasKey` | Returns true if a dictionary contains the given key. |
| `pluck` | Gets a list of all of the matching values in a set of maps given a key. |
| `dig` | Returns the value in a nested map given a path of keys. |
| `merge`\* | Merges two or more dictionaries into one. |
| `mergeOverwrite`\* | Identical to `merge`, but giving precedence from right to left. |
| `keys` | Returns a list of all of the keys in a dictionary. |
| `pick` | Creates a new dictionary containing only the given keys of an existing map. |
| `omit` | Creates a new dictionary containing all the keys of an existing map except the ones given. |
| `values` | Returns a list of all the values in a dictionary. |
#### [Type Conversion Functions][type-conversion-functions]
| Function | Description |
| ----------- | ------------------------------------------------------ |
| `atoi` | Converts a string to an integer. |
| `float64` | Converts to a float64. |
| `int` | Converts to an int at the system's width. |
| `int64` | Converts to an int64. |
| `toDecimal` | Converts a unix octal to a int64. |
| `toString` | Converts to a string. |
| `toStrings` | Converts a list, slice, or array to a list of strings. |
| `toStrings` | Produces a slice of strings from any list. |
| `toDecimal` | Given a unix octal permission, produce a decimal. |
#### [Path and Filepath Functions][path-functions]
| Function | Description |
| --------- | ----------------------------------------- |
| `base` | Returns the last element of a path. |
| `dir` | Returns the directory of a path. |
| `clean` | Cleans up a path. |
| `ext` | Returns the file extension of a path. |
| `isAbs` | Checks if a path is absolute. |
| `osBase` | Returns the last element of a filepath. |
| `osDir` | Returns the directory of a filepath. |
| `osClean` | Cleans up a filepath. |
| `osExt` | Returns the file extension of a filepath. |
| `osIsAbs` | Checks if a filepath is absolute. |
:::note
More filepath encoding functions are [provided directly by Task](#task-functions).
:::
#### [Flow Control Functions][flow-control-functions]
| Function | Description |
| -------- | ----------------------------------------------------------------------------- |
| `fail` | Unconditionally returns an empty string and an error with the specified text. |
#### [OS Functions][os-functions]
| Function | Description |
| ----------- | --------------------------------------------- |
| `env` | Reads an environment variable. |
| `expandenv` | Substitutes environment variables in a string |
#### [Reflection Functions][reflection-functions]
| Function | Description |
| ------------ | ------------------------------------------------------ |
| `kindOf` | Returns the kind of a value. |
| `kindIs` | Verifies that a value is a particular kind. |
| `typeOf` | Returns the underlying type of a value. |
| `typeIs` | Verifies that a value is of a particular type. |
| `typeIsLike` | Identical to `typeIs`, but also dereferences pointers. |
| `deepEqual` | Returns true if two values are "deeply equal". |
#### [Cryptographic and Security Functions][crypto-functions]
| Function | Description |
| ------------ | -------------------------------------- |
| `sha1sum` | Computes a string's SHA1 digest. |
| `sha256sum` | Computes a string's SHA256 digest. |
| `adler32sum` | Computes a string's Adler-32 checksum. |
### Task Functions
Lastly, Task itself provides a few functions:
| Function | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `OS` | Returns the operating system. Possible values are `windows`, `linux`, `darwin` (macOS) and `freebsd`. |
| `ARCH` | Returns the architecture Task was compiled to: `386`, `amd64`, `arm` or `s390x`. |
| `numCPU` | Returns the number of logical CPU's usable by the current process. |
| `splitLines` | Splits Unix (`\n`) and Windows (`\r\n`) styled newlines. |
| `catLines` | Replaces Unix (`\n`) and Windows (`\r\n`) styled newlines with a space. |
| `toSlash` | Does nothing on Unix, but on Windows converts a string from `\` path format to `/`. |
| `fromSlash` | Opposite of `toSlash`. Does nothing on Unix, but on Windows converts a string from `/` path format to `\`. |
| `exeExt` | Returns the right executable extension for the current OS (`".exe"` for Windows, `""` for others). |
| `shellQuote` | (aliased to `q`): Quotes a string to make it safe for use in shell scripts. Task uses [this Go function](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote) for this. The Bash dialect is assumed. |
| `splitArgs` | Splits a string as if it were a command's arguments. Task uses [this Go function](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/shell#Fields). |
| `joinPath` | Joins any number of arguments into a path. The same as Go's [filepath.Join](https://pkg.go.dev/path/filepath#Join). |
| `relPath` | Converts an absolute path (second argument) into a relative path, based on a base path (first argument). The same as Go's [filepath.Rel](https://pkg.go.dev/path/filepath#Rel). |
| `merge` | Creates a new map that is a copy of the first map with the keys of each subsequent map merged into it. If there is a duplicate key, the value of the last map with that key is used. |
| `spew` | Returns the Go representation of a specific variable. Useful for debugging. Uses the [davecgh/go-spew](https://github.com/davecgh/go-spew) package. |
| `fromYaml`\* | Decodes a YAML string into an object. |
| `toYaml`\* | Encodes an object as a YAML string. |
| `uuid` | Generates a new pseudo-random UUIDv4 string. |
| `randIntN` | Generates a new pseudo-random, non-negative, 32bit integer in the half-open interval `[0,n)`. Generated numbers are not suitable for security-sensitive work. |
{/* prettier-ignore-start */}
[text/template]: https://pkg.go.dev/text/template
[html/template]: https://pkg.go.dev/html/template
[go-template-functions]: https://pkg.go.dev/text/template#hdr-Functions
[slim-sprig]: https://go-task.github.io/slim-sprig/
[os-functions]: https://go-task.github.io/slim-sprig/os.html
[string-functions]: https://go-task.github.io/slim-sprig/strings.html
[string-list-functions]: https://go-task.github.io/slim-sprig/string_slice.html
[math-functions]: https://go-task.github.io/slim-sprig/math.html
[integer-list-functions]: https://go-task.github.io/slim-sprig/integer_slice.html
[date-functions]: https://go-task.github.io/slim-sprig/date.html
[default-functions]: https://go-task.github.io/slim-sprig/defaults.html
[encoding-functions]: https://go-task.github.io/slim-sprig/encoding.html
[list-functions]: https://go-task.github.io/slim-sprig/lists.html
[dictionary-functions]: https://go-task.github.io/slim-sprig/dicts.html
[type-conversion-functions]: https://go-task.github.io/slim-sprig/conversion.html
[path-functions]: https://go-task.github.io/slim-sprig/paths.html
[flow-control-functions]: https://go-task.github.io/slim-sprig/flow_control.html
[os-functions]: https://go-task.github.io/slim-sprig/os.html
[reflection-functions]: https://go-task.github.io/slim-sprig/reflection.html
[crypto-functions]: https://go-task.github.io/slim-sprig/crypto.html
{/* prettier-ignore-end */}

View File

@@ -1,72 +0,0 @@
---
slug: /releasing/
sidebar_position: 13
---
# Releasing
The release process of Task is done with the help of [GoReleaser][goreleaser].
You can test the release process locally by calling the `test-release` task of
the Taskfile.
[GitHub Actions](https://github.com/go-task/task/actions) should release
artifacts automatically when a new Git tag is pushed to `main` branch (raw
executables and DEB and RPM packages).
Since v3.15.0, raw executables can also be reproduced and verified locally by
checking out a specific tag and calling `goreleaser build`, using the Go version
defined in the above GitHub Actions.
# Homebrew
Goreleaser will automatically push a new commit to the
[Formula/go-task.rb][gotaskrb] file in the [Homebrew tap][homebrewtap]
repository to release the new version.
# npm
To release to npm update the version in the [`package.json`][packagejson] file
and then run `task npm:publish` to push it.
# Snapcraft
The [snap package][snappackage] requires to manual steps to release a new
version:
- Updating the current version on [snapcraft.yaml][snapcraftyaml].
- Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel
on the [Snapcraft dashboard][snapcraftdashboard].
# winget
winget also requires manual steps to be completed. By running
`task goreleaser:test` locally, manifest files will be generated on
`dist/winget/manifests/t/Task/Task/v{version}`.
[Upload the manifest directory into this fork](https://github.com/go-task/winget-pkgs/tree/master/manifests/t/Task/Task)
and open a pull request into
[this repository](https://github.com/microsoft/winget-pkgs).
# Scoop
Scoop is a command-line package manager for the Windows operating system. Scoop
package manifests are maintained by the community. Scoop owners usually take
care of updating versions there by editing
[this file](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json).
If you think its Task version is outdated, open an issue to let us know.
# Nix
Nix is a community owned installation method. Nix package maintainers usually
take care of updating versions there by editing
[this file](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/go/go-task/package.nix).
If you think its Task version is outdated, open an issue to let us know.
{/* prettier-ignore-start */}
[goreleaser]: https://goreleaser.com/
[homebrewtap]: https://github.com/go-task/homebrew-tap
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb
[packagejson]: https://github.com/go-task/task/blob/main/package.json#L3
[snappackage]: https://github.com/go-task/snap
[snapcraftyaml]: https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml#L2
[snapcraftdashboard]: https://snapcraft.io/task/releases
{/* prettier-ignore-end */}

View File

@@ -1,72 +0,0 @@
---
slug: /taskfile-versions/
sidebar_position: 6
---
# Taskfile Versions
The Taskfile schema slowly changes as new features are added and old ones are
removed. This document explains how to use a Taskfile's schema version to ensure
that the users of your Taskfile are using the correct versions of Task.
## What the Taskfile version means
The schema version at the top of every Taskfile corresponds to a version of the
Task CLI, and by extension, the features that are provided by that version. When
creating a Taskfile, you should specify the _minimum_ version of Task that
supports the features you require. If you try to run a Taskfile with a version
of Task that does not meet this minimum required version, it will exit with an
error. For example, given a Taskfile that starts with:
```yaml
version: '3.2.1'
```
When executed with Task `v3.2.0`, it will exit with an error. Running with
version `v3.2.1` or higher will work as expected.
Task accepts any [SemVer][semver] compatible string including versions which
omit the minor or patch numbers. For example, `3`, `3.0`, and `3.0.0` all mean
the same thing and are all valid. Most Taskfiles only specify the major version
number. However it can be useful to be more specific when you intend to share a
Taskfile with others.
For example, the Taskfile below makes use of aliases:
```yaml
version: '3'
tasks:
hello:
aliases:
- hi
- hey
cmds:
- echo "Hello, world!"
```
Aliases were introduced in Task `v3.17.0`, but the Taskfile only specifies `3`
as the version. This means that a user who has `v3.16.0` or lower installed will
get a potentially confusing error message when trying to run the Task as the
Taskfile specifies that any version greater or equal to `v3.0.0` is fine.
Instead, we should start the file like this:
```yaml
version: '3.17'
```
Now when someone tries to run the Taskfile with an older version of Task, they
will receive an error prompting them to upgrade their version of Task to
`v3.17.0` or greater.
## Versions 1 & 2
Version 1 and 2 of Task are no longer officially supported and anyone still
using them is strongly encouraged to upgrade to the latest version of Task.
While `version: 2` of Task did support schema versions, the behavior did not
work in quite the same way and cannot be relied upon for the purposes discussed
above.
[semver]: https://semver.org/

File diff suppressed because it is too large Load Diff

View File

@@ -1,249 +0,0 @@
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import { EnumChangefreq } from 'sitemap';
import remarkGithub from 'remark-github';
import remarkGfm from 'remark-gfm';
import { DISCORD_URL } from './constants';
import { GITHUB_URL } from './constants';
import { BLUESKY_URL } from './constants';
import { MASTODON_URL } from './constants';
import { TWITTER_URL } from './constants';
import { STACK_OVERFLOW } from './constants';
import { ANSWER_OVERFLOW } from './constants';
import lightCodeTheme from './src/themes/prismLight';
import darkCodeTheme from './src/themes/prismDark';
const config: Config = {
title: 'Task',
tagline: 'A task runner / simpler Make alternative written in Go ',
url: 'https://taskfile.dev',
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'go-task',
projectName: 'task',
deploymentBranch: 'gh-pages',
i18n: {
defaultLocale: 'en',
locales: ['en'],
localeConfigs: {
en: {
label: 'English',
direction: 'ltr',
htmlLang: 'en-US'
}
}
},
presets: [
[
'classic',
{
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.ts',
remarkPlugins: [remarkGithub, remarkGfm],
includeCurrentVersion: true,
versions: {
current: {
label: `Next 🚧`,
path: 'next',
badge: false
},
latest: {
label: 'Latest',
badge: false
}
}
},
blog: {
blogSidebarTitle: 'All posts',
blogSidebarCount: 'ALL'
},
theme: {
customCss: [
'./src/css/custom.css',
'./src/css/carbon.css',
]
},
gtag: {
trackingID: 'G-4RT25NXQ7N',
anonymizeIP: true
},
sitemap: {
changefreq: EnumChangefreq.WEEKLY,
priority: 0.5,
ignorePatterns: ['/tags/**']
}
} satisfies Preset.Options,
]
],
scripts: [
{
src: '/js/carbon.js',
async: true
}
],
themeConfig:{
metadata: [
{
name: 'og:image',
content: 'https://taskfile.dev/img/og-image.png'
}
],
navbar: {
title: 'Task',
logo: {
alt: 'Task Logo',
src: 'img/logo.svg'
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Docs'
},
{
to: 'blog',
label: 'Blog',
position: 'left'
},
{
to: '/donate',
position: 'left',
label: 'Donate'
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownActiveClassDisabled: true,
},
{
href: GITHUB_URL,
title: 'GitHub',
position: 'right',
className: "header-icon-link icon-github",
},
{
href: DISCORD_URL,
title: 'Discord',
position: 'right',
className: "header-icon-link icon-discord",
},
{
href: TWITTER_URL,
title: 'X (Twitter)',
position: 'right',
className: "header-icon-link icon-twitter",
},
{
href: BLUESKY_URL,
title: 'Bluesky',
position: 'right',
className: "header-icon-link icon-bluesky",
},
{
href: MASTODON_URL,
title: 'Mastodon',
rel: 'me',
position: 'right',
className: "header-icon-link icon-mastodon",
}
]
},
footer: {
style: 'dark',
links: [
{
title: 'Pages',
items: [
{
label: 'Installation',
to: '/installation/'
},
{
label: 'Usage',
to: '/usage/'
},
{
label: 'Donate',
to: '/donate/'
}
]
},
{
title: 'Community',
items: [
{
label: 'GitHub',
href: GITHUB_URL
},
{
label: 'Discord',
href: DISCORD_URL
},
{
label: 'Twitter',
href: TWITTER_URL
},
{
label: 'Bluesky',
href: BLUESKY_URL,
rel: 'me'
},
{
label: 'Mastodon',
href: MASTODON_URL,
rel: 'me'
},
{
label: 'Stack Overflow',
href: STACK_OVERFLOW
},
{
label: 'Answer Overflow',
href: ANSWER_OVERFLOW
},
{
label: 'OpenCollective',
href: 'https://opencollective.com/task'
}
]
},
{
items: [
{
html: '<a target="_blank" href="https://www.netlify.com"><img src="https://www.netlify.com/v3/img/components/netlify-color-accent.svg" alt="Deploys by Netlify" /></a>'
}
]
}
]
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: [
"bash", // aka. shell
"json",
"powershell"
]
},
// NOTE(@andreynering): Don't worry, these keys are meant to be public =)
algolia: {
appId: '7IZIJ13AI7',
apiKey: '34b64ae4fc8d9da43d9a13d9710aaddc',
indexName: 'taskfile'
}
} satisfies Preset.ThemeConfig,
};
export default config;

3
website/netlify.toml Normal file
View File

@@ -0,0 +1,3 @@
[build]
publish = ".vitepress/dist"
command = "pnpm run build"

View File

@@ -1,54 +1,25 @@
{
"name": "taskfile-dev",
"version": "0.0.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/go-task/task"
},
"name": "website2",
"version": "1.0.0",
"description": "",
"type": "module",
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^3.5.2",
"@docusaurus/preset-classic": "^3.5.2",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.1.0",
"raw-loader": "^4.0.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"remark-gfm": "^4.0.0",
"remark-github": "^12.0.0"
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview",
"lint": "prettier --write ."
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.5.2",
"@docusaurus/tsconfig": "^3.5.2",
"@docusaurus/types": "^3.5.2",
"@types/react": "^19.0.0",
"typescript": "^5.3.3"
},
"engines": {
"node": ">=18.0"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
"@types/markdown-it": "^14.1.2",
"@types/node": "^24.1.0",
"netlify-cli": "^23.1.1",
"prettier": "^3.6.2",
"vitepress": "^1.6.3",
"vitepress-plugin-group-icons": "^1.6.1",
"vitepress-plugin-tabs": "^0.7.1",
"vue": "^3.5.18"
}
}

9330
website/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,13 @@
module.exports = {
/**
* @see https://prettier.io/docs/configuration
* @type {import("prettier").Config}
*/
const config = {
trailingComma: 'none',
singleQuote: true,
overrides: [
{
files: ['*.md', '*.mdx'],
files: ['*.md'],
options: {
printWidth: 80,
proseWrap: 'always'
@@ -11,3 +15,5 @@ module.exports = {
}
]
};
export default config;

View File

@@ -1,14 +0,0 @@
import { SidebarsConfig } from '@docusaurus/plugin-content-docs';
export default {
taskSidebar: [
{
type: 'autogenerated',
dirName: '.'
},
{
type: 'html',
value: '<div id="sidebar-ads"></div>'
}
],
} satisfies SidebarsConfig;

View File

@@ -1,15 +1,13 @@
---
title: Any Variables
description: Task variables are no longer limited to strings!
slug: any-variables
authors: [pd93]
tags: [experiments, variables]
image: https://i.imgur.com/mErPwqL.png
hide_table_of_contents: false
author: pd93
date: 2024-05-09
outline: deep
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Any Variables
<AuthorCard :author="$frontmatter.author" />
Task has always had variables, but even though you were able to define them
using different YAML types, they would always be converted to strings by Task.
@@ -18,8 +16,6 @@ simple problems. Starting from [v3.37.0][v3.37.0], this is no longer the case!
Task now supports most variable types, including **booleans**, **integers**,
**floats** and **arrays**!
{/* truncate */}
## What's the big deal?
These changes allow you to use variables in a much more natural way and opens up
@@ -31,10 +27,9 @@ some of the examples below for some inspiration.
No more comparing strings to "true" or "false". Now you can use actual boolean
values in your templates:
<Tabs defaultValue="2">
<TabItem value="1" label="Before">
::: code-group
```yaml
```yaml [Before]
version: 3
tasks:
@@ -45,10 +40,7 @@ tasks:
- '{{if eq .BOOL "true"}}echo foo{{end}}'
```
</TabItem>
<TabItem value="2" label="After">
```yaml
```yaml [After]
version: 3
tasks:
@@ -59,8 +51,7 @@ tasks:
- '{{if .BOOL}}echo foo{{end}}' # <-- No need to compare to "true"
```
</TabItem>
</Tabs>
:::
### Arithmetic
@@ -110,10 +101,9 @@ to specify the delimiter. However, we have now added support for looping over
"collection-type" variables using the `for` keyword, so now you are able to loop
over list variables directly:
<Tabs defaultValue="2">
<TabItem value="1" label="Before">
::: code-group
```yaml
```yaml [Before]
version: 3
tasks:
@@ -127,10 +117,7 @@ tasks:
cmd: echo {{.ITEM}}
```
</TabItem>
<TabItem value="2" label="After">
```yaml
```yaml [After]
version: 3
tasks:
@@ -143,8 +130,7 @@ tasks:
cmd: echo {{.ITEM}}
```
</TabItem>
</Tabs>
:::
## What about maps?
@@ -154,20 +140,9 @@ at once, we have released support for all other variable types and we will
continue working on map support in the new "[Map Variables][map-variables]"
experiment.
:::note
If you were previously using maps with the Any Variables experiment and wish to
continue using them, you will need to enable the new [Map Variables
experiment][map-variables] instead.
:::
We're looking for feedback on a couple of different proposals, so please give
them a go and let us know what you think. :pray:
{/* prettier-ignore-start */}
[v3.37.0]: https://github.com/go-task/task/releases/tag/v3.37.0
[slim-sprig-math]: https://go-task.github.io/slim-sprig/math.html
[slim-sprig-list]: https://go-task.github.io/slim-sprig/lists.html
[map-variables]: /experiments/map-variables
{/* prettier-ignore-end */}

22
website/src/blog/index.md Normal file
View File

@@ -0,0 +1,22 @@
---
title: Blog
description: Latest news and updates from the Task team
---
<BlogPost
title="Any Variables"
url="/blog/any-variables"
date="2024-05-09"
author="pd93"
description="Task has always had variables, but even though you were able to define them using different YAML types, they would always be converted to strings by Task. This limited users to string manipulation and encouraged messy workarounds for simple problems. Starting from v3.37.0, this is no longer the case! Task now supports most variable types, including booleans, integers, floats and arrays!"
:tags="['experiments', 'variables']"
/>
<BlogPost
title="Introducing Experiments"
url="/blog/task-in-2023"
date="2023-09-02"
author="pd93"
description="A look at where Task is, where it's going and how we're going to get there. Lately, Task has been growing extremely quickly and I've found myself thinking a lot about the future of the project and how we continue to evolve and grow. I'm not much of a writer, but I think one of the things we could do better is to communicate these kinds of thoughts to the community."
:tags="['roadmap', 'experiments', 'community']"
/>

View File

@@ -2,13 +2,15 @@
title: Introducing Experiments
description:
A look at where task is, where it's going and how we're going to get there.
slug: task-in-2023
authors: [pd93]
tags: [experiments, breaking-changes, roadmap, v4]
image: https://i.imgur.com/mErPwqL.png
hide_table_of_contents: false
author: pd93
date: 2024-05-09
outline: deep
---
# Introducing Experiments
<AuthorCard :author="$frontmatter.author" />
Lately, Task has been growing extremely quickly and I've found myself thinking a
lot about the future of the project and how we continue to evolve and grow. I'm
not much of a writer, but I think one of the things we could do better is to
@@ -16,19 +18,17 @@ communicate these kinds of thoughts to the community. So, with that in mind,
this is the first (hopefully of many) blog posts talking about Task and what
we're up to.
{/* truncate */}
## :calendar: So, what have we been up to?
Over the past 12 months or so, [@andreynering] (Author and maintainer of the
project) and I ([@pd93]) have been working in our spare time to maintain and
Over the past 12 months or so, @andreynering (Author and maintainer of the
project) and I (@pd93) have been working in our spare time to maintain and
improve v3 of Task and we've made some amazing progress. Here are just some of
the things we've released in that time:
- An official [extension for VS Code][vscode-task].
- Internal Tasks ([#818](https://github.com/go-task/task/pull/818)).
- Task aliases ([#879](https://github.com/go-task/task/pull/879)).
- Looping over tasks ([#1220](https://github.com/go-task/task/pull/1200)).
- Internal Tasks (#818).
- Task aliases (#879).
- Looping over tasks (#1220).
- A series of refactors to the core codebase to make it more maintainable and
extensible.
- Loads of bug fixes and improvements.
@@ -38,14 +38,13 @@ the things we've released in that time:
- And much, much more! :sparkles:
We're also working on adding some really exciting and highly requested features
to Task such as having the ability to run remote Taskfiles
([#1317](https://github.com/go-task/task/issues/1317)).
to Task such as having the ability to run remote Taskfiles (#1317).
None of this would have been possible without the [150 or so (and growing)
contributors][contributors] to the project, numerous sponsors and a passionate
community of users. Together we have more than doubled the number of GitHub
stars to over 8400 :star: since the beginning of 2022 and this continues to
accelerate. We can't thank you all enough for your help and support! :rocket:
accelerate. We can't thank you all enough for your help and support! 🚀
[![Star History Chart](https://api.star-history.com/svg?repos=go-task/task&type=Date)](https://star-history.com/#go-task/task&Date)
@@ -71,7 +70,7 @@ commitment to make. Smaller, more frequent major releases are also a significant
inconvenience for users as they have to constantly keep up-to-date with our
breaking changes. Fortunately, there is a better way.
## What's going to change? :monocle:
## What's going to change? :monocle_face:
Going forwards, breaking changes will be allowed into _minor_ versions of Task
as "experimental features". To access these features users will need opt-in by
@@ -122,14 +121,11 @@ I plan to write more of these blog posts in the future on a variety of
Task-related topics, so make sure to check in occasionally and see what we're up
to!
{/* prettier-ignore-start */}
[vscode-task]: https://github.com/go-task/vscode-task
[crowdin]: https://crowdin.com
[contributors]: https://github.com/go-task/task/graphs/contributors
[semver]: https://semver.org
[breaking-change-proposal]: https://github.com/go-task/task/discussions/1191
[@andreynering]: https://github.com/andreynering
[@pd93]: https://github.com/pd93
[experiments]: https://taskfile.dev/experiments
[deprecations]: https://taskfile.dev/deprecations
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
@@ -139,4 +135,3 @@ to!
[experiments-project]: https://github.com/orgs/go-task/projects/1
[gentle-force-experiment]: https://github.com/go-task/task/issues/1200
[remote-taskfiles-experiment]: https://github.com/go-task/task/issues/1317
{/* prettier-ignore-end */}

View File

@@ -1,65 +0,0 @@
#carbonads * {
margin: initial;
padding: initial;
}
#carbonads {
display: flex;
max-width: 330px;
background-color: hsl(0, 0%, 98%);
box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, 0.1);
z-index: 100;
}
#carbonads a {
color: inherit;
text-decoration: none;
}
#carbonads a:hover {
color: inherit;
}
#carbonads span {
position: relative;
display: block;
overflow: hidden;
}
#carbonads .carbon-wrap {
display: flex;
}
#carbonads .carbon-img {
display: block;
margin: 0;
line-height: 1;
}
#carbonads .carbon-img img {
display: block;
}
#carbonads .carbon-text {
font-size: 13px;
padding: 10px;
margin-bottom: 16px;
line-height: 1.5;
text-align: left;
}
#carbonads .carbon-poweredby {
display: block;
padding: 6px 8px;
background: #f1f1f2;
text-align: center;
text-transform: uppercase;
letter-spacing: 0.5px;
font-weight: 600;
font-size: 8px;
line-height: 1;
border-top-left-radius: 3px;
position: absolute;
bottom: 0;
right: 0;
}
[data-theme='dark'] #carbonads {
background-color: hsl(0, 0%, 35%);
box-shadow: 0 1px 4px 1px hsl(0, 0%, 55%);
}
[data-theme='dark'] #carbonads .carbon-poweredby {
background-color: hsl(0, 0%, 55%);
}

View File

@@ -1,123 +0,0 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,400;0,700;1,400;1,700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap');
:root {
--ifm-font-family-base: Roboto, system-ui, -apple-system, Segoe UI, Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
--ifm-font-family-monospace: 'Roboto Mono', SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
--ifm-color-primary: #43ABA2 ;
--ifm-color-primary-dark: #3AB2A6;
--ifm-color-primary-darker: #32B8AB;
--ifm-color-primary-darkest: #29BEB0;
--ifm-color-primary-light: #4CA59D;
--ifm-color-primary-lighter: #559F98;
--ifm-color-primary-lightest: #5D9993;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
--ifm-navbar-link-color: #fffdf9;
--ifm-navbar-link-hover-color: #43aba2;
}
.menu__link--sublist.menu__link--active,
.menu__link--sublist.menu__link--active:hover {
background-color: #43aba2 !important;
}
[data-theme='light'] {
--ifm-background-color: #fffdf9;
--ifm-background-surface-color: #2b2d31;
--ifm-color-primary: #43aba2;
--ifm-dropdown-link-color: #fffdf9;
--ifm-link-color: #43aba2;
--ifm-breadcrumb-color-active: #2b2d31;
}
.menu, .navbar, .navbar-sidebar {
--ifm-menu-color-background-active: #43aba2;
--ifm-menu-color-active: #fffdf9;
}
.navbar, .navbar-sidebar {
--ifm-menu-color: #fffdf9;
}
.navbar-sidebar__back {
color: #fffdf9;
}
[data-theme='light'] svg[class*="lightToggleIcon"],
[data-theme='light'] .navbar__toggle {
color: #fffdf9 !important;
}
[data-theme='light'] div[class*="codeBlockTitle"],
[data-theme='light'] code[class*="codeBlockLines"] {
background-color: #f7f5f1 !important;
}
[data-theme='dark'], .footer--dark {
--ifm-background-color: #242526 !important;
--ifm-background-surface-color: #2b2d31 !important;
--ifm-footer-background-color: #2b2d31 !important;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
.code-block--max-width {
width: 100%;
}
#carbonads {
margin-top: 30px;
margin-right: 10px;
}
.gold-sponsors {
display: flex;
justify-content: center;
}
.gold-sponsors table img {
width: 200px;
}
.menu__list-item:has(.header-icon-link) {
float: left;
}
.menu__list-item:has(.header-icon-link) .header-icon-link {
margin-top: 10px;
}
.header-icon-link::before {
content: '';
width: 24px;
height: 24px;
display: flex;
background-color: var(--ifm-navbar-link-color);
transition: background-color var(--ifm-transition-fast)
var(--ifm-transition-timing-default);
mask-size: contain;
mask-repeat: no-repeat;
mask-position: center;
}
.header-icon-link:hover::before {
background-color: var(--ifm-navbar-link-hover-color);
}
.icon-github::before {
mask-image: url('/img/icon-github.svg');
}
.icon-discord::before {
mask-image: url('/img/icon-discord.svg');
}
.icon-mastodon::before {
mask-image: url('/img/icon-mastodon.svg');
}
.icon-twitter::before {
mask-image: url('/img/icon-twitter.svg');
}
.icon-bluesky::before {
mask-image: url('/img/icon-bluesky.svg');
}

View File

@@ -1,6 +1,6 @@
---
slug: /changelog/
sidebar_position: 14
title: Changelog
outline: deep
---
# Changelog
@@ -92,8 +92,8 @@ Reverted the changes made in #2113 and #2186 that affected the
- The default taskfile (output when using the `--init` flag) is now an embedded
file in the binary instead of being stored in the code (#2112 by @pd93).
- Improved the way we report the Task version when using the `--version` flag or
`{{.TASK_VERSION}}` variable. This should now be more consistent and easier
for package maintainers to use (#2131 by @pd93).
<span v-pre>`{{.TASK_VERSION}}`</span> variable. This should now be more
consistent and easier for package maintainers to use (#2131 by @pd93).
- Fixed a bug where globstar (`**`) matching in `sources` only resolved the
first result (#2073, #2075 by @pd93).
- Fixed a bug where sorting tasks by "none" would use the default sorting
@@ -107,7 +107,7 @@ Reverted the changes made in #2113 and #2186 that affected the
- Fix Fish completions when `--global` (`-g`) is given (#2134 by @atusy).
- Fixed variables not available when using `defer:` (#1909, #2173 by @vmaerten).
#### Package API
### Package API
- The [`Executor`](https://pkg.go.dev/github.com/go-task/task/v3#Executor) now
uses the functional options pattern (#2085, #2147, #2148 by @pd93).
@@ -164,7 +164,7 @@ Reverted the changes made in #2113 and #2186 that affected the
used, all other variables become unavailable in the templating system within
the include (#2092 by @vmaerten).
#### Package API
### Package API
Unlike our CLI tool,
[Task's package API is not currently stable](https://taskfile.dev/reference/package).
@@ -500,360 +500,7 @@ stabilize the API in the future. #121 now tracks this piece of work.
- The
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
now prefers remote files over cached ones by default (#1317, #1345 by @pd93).
- Added `--timeout` flag to the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
(#1317, #1345 by @pd93).
- Fix bug where dynamic `vars:` and `env:` were being executed when they should
actually be skipped by `platforms:` (#1273, #1377 by @andreynering).
- Fix `schema.json` to make `silent` valid in `cmds` that use `for` (#1385,
#1386 by @iainvm).
- Add new `--no-status` flag to skip expensive status checks when running
`task --list --json` (#1348, #1368 by @amancevice).
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
(#1317, #1344 by @pd93).
- Add ability to set `watch: true` in a task to automatically run it in watch
mode (#231, #1361 by @andreynering).
- Fixed a bug on the watch mode where paths that contained `.git` (like
`.github`), for example, were also being ignored (#1356 by @butuzov).
- Fixed a nil pointer error when running a Taskfile with no contents (#1341,
#1342 by @pd93).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a
Taskfile does not contain a schema version (#1342 by @pd93).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people
have been reaching this limit organically now that we have loops. This check
exists to detect recursive calls, but will be removed in favor of a better
algorithm soon (#1321, #1332).
- Fixed templating on descriptions on `task --list` (#1343 by @blackjid).
- Fixed a bug where precondition errors were incorrectly being printed when task
execution was aborted (#1337, #1338 by @sylv-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly
(#1331, #1334 by @pd93).
## v3.30.0 - 2023-09-13
- Prep work for Remote Taskfiles (#1316 by @pd93).
- Added the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
as a draft (#1152, #1317 by @pd93).
- Improve performance of content checksumming on `sources:` by replacing md5
with [XXH3](https://xxhash.com/) which is much faster. This is a soft breaking
change because checksums will be invalidated when upgrading to this release
(#1325 by @ReillyBrogan).
## v3.29.1 - 2023-08-26
- Update to Go 1.21 (bump minimum version to 1.20) (#1302 by @pd93)
- Fix a missing a line break on log when using `--watch` mode (#1285, #1297 by
@FilipSolich).
- Fix `defer` on JSON Schema (#1288 by @calvinmclean and @andreynering).
- Fix bug in usage of special variables like `{{.USER_WORKING_DIR}}` in
combination with `includes` (#1046, #1205, #1250, #1293, #1312, #1274 by
@andarto, #1309 by @andreynering).
- Fix bug on `--status` flag. Running this flag should not have side-effects: it
should not update the checksum on `.task`, only report its status (#1305,
#1307 by @visciang, #1313 by @andreynering).
## v3.28.0 - 2023-07-24
- Added the ability to
[loop over commands and tasks](https://taskfile.dev/usage/#looping-over-values)
using `for` (#82, #1220 by @pd93).
- Fixed variable propagation in multi-level includes (#778, #996, #1256 by
@hudclark).
- Fixed a bug where the `--exit-code` code flag was not returning the correct
exit code when calling commands indirectly (#1266, #1270 by @pd93).
- Fixed a `nil` panic when a dependency was commented out or left empty (#1263
by @neomantra).
## v3.27.1 - 2023-06-30
- Fix panic when a `.env` directory (not file) is present on current directory
(#1244, #1245 by @pd93).
## v3.27.0 - 2023-06-29
- Allow Taskfiles starting with lowercase characters (#947, #1221 by @pd93).
- e.g. `taskfile.yml`, `taskfile.yaml`, `taskfile.dist.yml` &
`taskfile.dist.yaml`
- Bug fixes were made to the
[npm installation method](https://taskfile.dev/installation/#npm). (#1190, by
@sounisi5011).
- Added the
[gentle force experiment](https://taskfile.dev/experiments/gentle-force) as a
draft (#1200, #1216 by @pd93).
- Added an `--experiments` flag to allow you to see which experiments are
enabled (#1242 by @pd93).
- Added ability to specify which variables are required in a task (#1203, #1204
by @benc-uk).
## v3.26.0 - 2023-06-10
- Only rewrite checksum files in `.task` if the checksum has changed (#1185,
#1194 by @deviantintegral).
- Added [experiments documentation](https://taskfile.dev/experiments) to the
website (#1198 by @pd93).
- Deprecated `version: 2` schema. This will be removed in the next major release
(#1197, #1198, #1199 by @pd93).
- Added a new `prompt:` prop to set a warning prompt to be shown before running
a potential dangerous task (#100, #1163 by @MaxCheetham,
[Documentation](https://taskfile.dev/usage/#warning-prompts)).
- Added support for single command task syntax. With this change, it's now
possible to declare just `cmd:` in a task, avoiding the more complex
`cmds: []` when you have only a single command for that task (#1130, #1131 by
@timdp).
## v3.25.0 - 2023-05-22
- Support `silent:` when calling another tasks (#680, #1142 by @danquah).
- Improve PowerShell completion script (#1168 by @trim21).
- Add more languages to the website menu and show translation progress
percentage (#1173 by @misitebao).
- Starting on this release, official binaries for FreeBSD will be available to
download (#1068 by @andreynering).
- Fix some errors being unintendedly suppressed (#1134 by @clintmod).
- Fix a nil pointer error when `version` is omitted from a Taskfile (#1148,
#1149 by @pd93).
- Fix duplicate error message when a task does not exists (#1141, #1144 by
@pd93).
## v3.24.0 - 2023-04-15
- Fix Fish shell completion for tasks with aliases (#1113 by @patricksjackson).
- The default branch was renamed from `master` to `main` (#1049, #1048 by
@pd93).
- Fix bug where "up-to-date" logs were not being omitted for silent tasks (#546,
#1107 by @danquah).
- Add `.hg` (Mercurial) to the list of ignored directories when using `--watch`
(#1098 by @misery).
- More improvements to the release tool (#1096 by @pd93).
- Enforce [gofumpt](https://github.com/mvdan/gofumpt) linter (#1099 by @pd93)
- Add `--sort` flag for use with `--list` and `--list-all` (#946, #1105 by
@pd93).
- Task now has [custom exit codes](https://taskfile.dev/api/#exit-codes)
depending on the error (#1114 by @pd93).
## v3.23.0 - 2023-03-26
Task now has an
[official extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=task.vscode-task)
contributed by @pd93! :tada: The extension is maintained in a
[new repository](https://github.com/go-task/vscode-task) under the `go-task`
organization. We're looking to gather feedback from the community so please give
it a go and let us know what you think via a
[discussion](https://github.com/go-task/vscode-task/discussions),
[issue](https://github.com/go-task/vscode-task/issues) or on our
[Discord](https://discord.gg/6TY36E39UK)!
> **NOTE:** The extension _requires_ v3.23.0 to be installed in order to work.
- The website was integrated with
[Crowdin](https://crowdin.com/project/taskfile) to allow the community to
contribute with translations! [Chinese](https://taskfile.dev/zh-Hans/) is the
first language available (#1057, #1058 by @misitebao).
- Added task location data to the `--json` flag output (#1056 by @pd93)
- Change the name of the file generated by `task --init` from `Taskfile.yaml` to
`Taskfile.yml` (#1062 by @misitebao).
- Added new `splitArgs` template function
(`{{splitArgs "foo bar 'foo bar baz'"}}`) to ensure string is split as
arguments (#1040, #1059 by @dhanusaputra).
- Fix the value of `{{.CHECKSUM}}` variable in status (#1076, #1080 by @pd93).
- Fixed deep copy implementation (#1072 by @pd93)
- Created a tool to assist with releases (#1086 by @pd93).
## v3.22.0 - 2023-03-10
- Add a brand new `--global` (`-g`) flag that will run a Taskfile from your
`$HOME` directory. This is useful to have automation that you can run from
anywhere in your system!
([Documentation](https://taskfile.dev/usage/#running-a-global-taskfile), #1029
by @andreynering).
- Add ability to set `error_only: true` on the `group` output mode. This will
instruct Task to only print a command output if it returned with a non-zero
exit code (#664, #1022 by @jaedle).
- Fixed bug where `.task/checksum` file was sometimes not being created when
task also declares a `status:` (#840, #1035 by @harelwa, #1037 by @pd93).
- Refactored and decoupled fingerprinting from the main Task executor (#1039 by
@pd93).
- Fixed deadlock issue when using `run: once` (#715, #1025 by
@theunrepentantgeek).
## v3.21.0 - 2023-02-22
- Added new `TASK_VERSION` special variable (#990, #1014 by @ja1code).
- Fixed a bug where tasks were sometimes incorrectly marked as internal (#1007
by @pd93).
- Update to Go 1.20 (bump minimum version to 1.19) (#1010 by @pd93)
- Added environment variable `FORCE_COLOR` support to force color output. Useful
for environments without TTY (#1003 by @automation-stack)
## v3.20.0 - 2023-01-14
- Improve behavior and performance of status checking when using the `timestamp`
mode (#976, #977 by @aminya).
- Performance optimizations were made for large Taskfiles (#982 by @pd93).
- Add ability to configure options for the
[`set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html)
and
[`shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html)
builtins (#908, #929 by @pd93,
[Documentation](http://taskfile.dev/usage/#set-and-shopt)).
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to
choose in which platforms that given task or command will be run on. Possible
values are operating system (GOOS), architecture (GOARCH) or a combination of
the two. Example: `platforms: [linux]`, `platforms: [amd64]` or
`platforms: [linux/amd64]`. Other platforms will be skipped (#978, #980 by
@leaanthony).
## v3.19.1 - 2022-12-31
- Small bug fix: closing `Taskfile.yml` once we're done reading it (#963, #964
by @HeCorr).
- Fixes a bug in v2 that caused a panic when using a `Taskfile_{{OS}}.yml` file
(#961, #971 by @pd93).
- Fixed a bug where watch intervals set in the Taskfile were not being respected
(#969, #970 by @pd93)
- Add `--json` flag (alias `-j`) with the intent to improve support for code
editors and add room to other possible integrations. This is basic for now,
but we plan to add more info in the near future (#936 by @davidalpert, #764).
## v3.19.0 - 2022-12-05
- Installation via npm now supports [pnpm](https://pnpm.io/) as well
([go-task/go-npm#2](https://github.com/go-task/go-npm/issues/2),
[go-task/go-npm#3](https://github.com/go-task/go-npm/pull/3)).
- It's now possible to run Taskfiles from subdirectories! A new
`USER_WORKING_DIR` special variable was added to add even more flexibility for
monorepos (#289, #920).
- Add task-level `dotenv` support (#389, #904).
- It's now possible to use global level variables on `includes` (#942, #943).
- The website got a brand new
[translation to Chinese](https://task-zh.readthedocs.io/zh_CN/latest/) by
[@DeronW](https://github.com/DeronW). Thanks!
## v3.18.0 - 2022-11-12
- Show aliases on `task --list --silent` (`task --ls`). This means that aliases
will be completed by the completion scripts (#919).
- Tasks in the root Taskfile will now be displayed first in
`--list`/`--list-all` output (#806, #890).
- It's now possible to call a `default` task in an included Taskfile by using
just the namespace. For example: `docs:default` is now automatically aliased
to `docs` (#661, #815).
## v3.17.0 - 2022-10-14
- Add a "Did you mean ...?" suggestion when a task does not exits another one
with a similar name is found (#867, #880).
- Now YAML parse errors will print which Taskfile failed to parse (#885, #887).
- Add ability to set `aliases` for tasks and namespaces (#268, #340, #879).
- Improvements to Fish shell completion (#897).
- Added ability to set a different watch interval by setting `interval: '500ms'`
or using the `--interval=500ms` flag (#813, #865).
- Add colored output to `--list`, `--list-all` and `--summary` flags (#845,
#874).
- Fix unexpected behavior where `label:` was being shown instead of the task
name on `--list` (#603, #877).
## v3.16.0 - 2022-09-29
- Add `npm` as new installation method: `npm i -g @go-task/cli` (#870, #871,
[npm package](https://www.npmjs.com/package/@go-task/cli)).
- Add support to marking tasks and includes as internal, which will hide them
from `--list` and `--list-all` (#818).
## v3.15.2 - 2022-09-08
- Fix error when using variable in `env:` introduced in the previous release
(#858, #866).
- Fix handling of `CLI_ARGS` (`--`) in Bash completion (#863).
- On zsh completion, add ability to replace `--list-all` with `--list` as
already possible on the Bash completion (#861).
## v3.15.0 - 2022-09-03
- Add new special variables `ROOT_DIR` and `TASKFILE_DIR`. This was a highly
requested feature (#215, #857,
[Documentation](https://taskfile.dev/api/#special-variables)).
- Follow symlinks on `sources` (#826, #831).
- Improvements and fixes to Bash completion (#835, #844).
## v3.14.1 - 2022-08-03
- Always resolve relative include paths relative to the including Taskfile
(#822, #823).
- Fix ZSH and PowerShell completions to consider all tasks instead of just the
public ones (those with descriptions) (#803).
## v3.14.0 - 2022-07-08
- Add ability to override the `.task` directory location with the
`TASK_TEMP_DIR` environment variable.
- Allow to override Task colors using environment variables: `TASK_COLOR_RESET`,
`TASK_COLOR_BLUE`, `TASK_COLOR_GREEN`, `TASK_COLOR_CYAN`, `TASK_COLOR_YELLOW`,
`TASK_COLOR_MAGENTA` and `TASK_COLOR_RED` (#568, #792).
- Fixed bug when using the `output: group` mode where STDOUT and STDERR were
being print in separated blocks instead of in the right order (#779).
- Starting on this release, ARM architecture binaries are been released to Snap
as well (#795).
- i386 binaries won't be available anymore on Snap because Ubuntu removed the
support for this architecture.
- Upgrade mvdan.cc/sh, which fixes a bug with associative arrays (#785,
[mvdan/sh#884](https://github.com/mvdan/sh/issues/884),
[mvdan/sh#893](https://github.com/mvdan/sh/pull/893)).
## v3.13.0 - 2022-06-13
- Added `-n` as an alias to `--dry` (#776, #777).
- Fix behavior of interrupt (SIGINT, SIGTERM) signals. Task will now give time
for the processes running to do cleanup work (#458, #479, #728, #769).
- Add new `--exit-code` (`-x`) flag that will pass-through the exit form the
command being ran (#755).
## v3.12.1 - 2022-05-10
- Fixed bug where, on Windows, variables were ending with `\r` because we were
only removing the final `\n` but not `\r\n` (#717).
## v3.12.0 - 2022-03-31
- The `--list` and `--list-all` flags can now be combined with the `--silent`
flag to print the task names only, without their description (#691).
- Added support for multi-level inclusion of Taskfiles. This means that included
Taskfiles can also include other Taskfiles. Before this was limited to one
level (#390, #623, #656).
- Add ability to specify vars when including a Taskfile.
[Check out the documentation](https://taskfile.dev/#/usage?id=vars-of-included-taskfiles)
for more information (#677).
## v3.11.0 - 2022-02-19
- Task now supports printing begin and end messages when using the `group`
output mode, useful for grouping tasks in CI systems.
[Check out the documentation](http://taskfile.dev/#/usage?id=output-syntax)
for more information (#647, #651).
- Add `Taskfile.dist.yml` and `Taskfile.dist.yaml` to the supported file name
list.
[Check out the documentation](https://taskfile.dev/#/usage?id=supported-file-names)
for more information (#498, #666).
## v3.10.0 - 2022-01-04
- A new `--list-all` (alias `-a`) flag is now available. It's similar to the
exiting `--list` (`-l`) but prints all tasks, even those without a description
(#383, #401).
- It's now possible to schedule cleanup commands to run once a task finishes
with the `defer:` keyword
([Documentation](https://taskfile.dev/#/usage?id=doing-task-cleanup-with-defer),
#475, #626).
- Remove long deprecated and undocumented `$` variable prefix and `^` command
prefix (#642, #644, #645).
variable prefix and `^` command prefix (#642, #644, #645).
- Add support for `.yaml` extension (as an alternative to `.yml`). This was
requested multiple times throughout the years. Enjoy! (#183, #184, #369, #584,
#621).
@@ -871,8 +518,8 @@ it a go and let us know what you think via a
- Add logging in verbose mode for when a task starts and finishes (#533, #588).
- Fix an issue with preconditions and context errors (#597, #598).
- Quote each `{{.CLI_ARGS}}` argument to prevent one with spaces to become many
(#613).
- Quote each <span v-pre>`{{.CLI_ARGS}}`</span> argument to prevent one with
spaces to become many (#613).
- Fix nil pointer when `cmd:` was left empty (#612, #614).
- Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains two relevant
fixes:
@@ -888,8 +535,8 @@ it a go and let us know what you think via a
## v3.9.0 - 2021-10-02
- A new `shellQuote` function was added to the template system
(`{{shellQuote "a string"}}`) to ensure a string is safe for use in shell
([mvdan/sh#727](https://github.com/mvdan/sh/pull/727),
(<span v-pre>`{{shellQuote "a string"}}`</span>) to ensure a string is safe
for use in shell ([mvdan/sh#727](https://github.com/mvdan/sh/pull/727),
[mvdan/sh#737](https://github.com/mvdan/sh/pull/737),
[Documentation](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote))
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded with

View File

@@ -1,6 +1,9 @@
---
slug: /community/
sidebar_position: 10
title: Community
description:
Task community contributions, installation methods, and integrations
maintained by third parties
outline: deep
---
# Community
@@ -13,7 +16,7 @@ thankful for everyone that helps me to improve the overall experience.
Many of our integrations are contributed and maintained by the community. You
can view the full list of community integrations
[here](/integrations#community-integrations).
[here](./integrations.md#community-integrations).
## Installation methods

View File

@@ -1,6 +1,9 @@
---
slug: /contributing/
sidebar_position: 12
title: Contributing
description:
Comprehensive guide for contributing to the Task project, including setup,
development, testing, and submitting PRs
outline: deep
---
# Contributing
@@ -8,7 +11,7 @@ sidebar_position: 12
Contributions to Task are very welcome, but we ask that you read this document
before submitting a PR.
:::note
::: info
This document applies to the core [Task][task] repository _and_ [Task for Visual
Studio Code][vscode-task].
@@ -27,9 +30,10 @@ Studio Code][vscode-task].
you invest your time into a PR.
- **Experiments** - If there is no way to make your change backward compatible
then there is a procedure to introduce breaking changes into minor versions.
We call these "[experiments][experiments]". If you're intending to work on an
experiment, then please read the [experiments workflow][experiments-workflow]
document carefully and submit a proposal first.
We call these "[experiments](./experiments/index.md)". If you're intending to work on
an experiment, then please read the
[experiments workflow](./experiments/index.md#workflow) document carefully and submit a
proposal first.
## 1. Setup
@@ -38,7 +42,7 @@ Studio Code][vscode-task].
- **Node.js** - [Node.js][nodejs] is used to host Task's documentation server
and is required if you want to run this server locally. It is also required if
you want to contribute to the Visual Studio Code extension.
- **Yarn** - [Yarn][yarn] is the Node.js package manager used by Task.
- **Pnpm** - [Pnpm][pnpm] is the Node.js package manager used by Task.
## 2. Making changes
@@ -49,10 +53,11 @@ Studio Code][vscode-task].
docs][golangci-lint-docs] for a guide on how to setup your editor to
auto-format your code. Any Markdown or TypeScript files should be formatted
and linted by [Prettier][prettier]. This style is enforced by our CI to ensure
that we have a consistent style across the project. You can use the `task
lint` command to lint the code locally and the `task lint:fix` command to try
to automatically fix any issues that are found. You can also use the `task
fmt` command to auto-format the files if your editor doesn't do it for you.
that we have a consistent style across the project. You can use the
`task lint` command to lint the code locally and the `task lint:fix` command
to try to automatically fix any issues that are found. You can also use the
`task fmt` command to auto-format the files if your editor doesn't do it for
you.
- **Documentation** - Ensure that you add/update any relevant documentation. See
the [updating documentation](#updating-documentation) section below.
- **Tests** - Ensure that you add/update any relevant tests and that all tests
@@ -74,24 +79,23 @@ install the extension.
### Updating documentation
Task uses [Docusaurus][docusaurus] to host a documentation server. The code for
Task uses [Vitepress][vitepress] to host a documentation server. The code for
this is located in the core Task repository. This can be setup and run locally
by using `task website` (requires `nodejs` & `yarn`). All content is written in
[MDX][mdx] (an extension of Markdown) and is located in the `website/docs`
directory. All Markdown documents should have an 80 character line wrap limit
(enforced by Prettier).
by using `task website` (requires `nodejs` & `pnpm`). All content is written in
Markdown and is located in the `website/src` directory. All Markdown documents
should have an 80 character line wrap limit (enforced by Prettier).
When making a change, consider whether a change to the [Usage Guide](/usage) is
When making a change, consider whether a change to the [Usage Guide](/docs/guide) is
necessary. This document contains descriptions and examples of how to use Task
features. If you're adding a new feature, try to find an appropriate place to
add a new section. If you're updating an existing feature, ensure that the
documentation and any examples are up-to-date. Ensure that any examples follow
the [Taskfile Styleguide](/styleguide).
the [Taskfile Styleguide](./styleguide.md).
If you added a new command or flag, ensure that you add it to the [CLI
Reference](/reference/cli). New fields also need to be added to the [Schema
Reference](/reference/schema) and [JSON Schema][json-schema]. The descriptions
for fields in the docs and the schema should match.
If you added a new command or flag, ensure that you add it to the
[CLI Reference](./reference/cli.md). New fields also need to be added to the
[Schema Reference](./reference/schema.md) and [JSON Schema][json-schema]. The
descriptions for fields in the docs and the schema should match.
### Writing tests
@@ -143,7 +147,7 @@ contributions.
All kinds of contributions are welcome, whether its a typo fix or a shiny new
feature. You can also contribute by upvoting/commenting on issues, helping to
answer questions or contributing to other [community projects](/community).
answer questions or contributing to other [community projects](./community.md).
> I'm stuck, where can I get help?
@@ -152,9 +156,6 @@ If you have questions, feel free to ask them in the `#help` forum channel on our
---
{/* prettier-ignore-start */}
[experiments]: /experiments
[experiments-workflow]: /experiments#workflow
[task]: https://github.com/go-task/task
[vscode-task]: https://github.com/go-task/vscode-task
[go]: https://go.dev
@@ -164,14 +165,15 @@ If you have questions, feel free to ask them in the `#help` forum channel on our
[golangci-lint-docs]: https://golangci-lint.run/welcome/integrations/
[prettier]: https://prettier.io
[nodejs]: https://nodejs.org/en/
[yarn]: https://yarnpkg.com/
[docusaurus]: https://docusaurus.io
[json-schema]: https://github.com/go-task/task/blob/main/website/static/schema.json
[pnpm]: https://pnpm.io/
[vitepress]: https://vitepress.dev
[json-schema]:
https://github.com/go-task/task/blob/main/website/static/schema.json
[task-open-issues]: https://github.com/go-task/task/issues
[vscode-task-open-issues]: https://github.com/go-task/vscode-task/issues
[good-first-issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
[good-first-issue]:
https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
[discord-server]: https://discord.gg/6TY36E39UK
[discussion]: https://github.com/go-task/task/discussions
[conventional-commits]: https://www.conventionalcommits.org
[mdx]: https://mdxjs.com/
{/* prettier-ignore-end */}

View File

@@ -1,10 +1,12 @@
---
slug: /deprecations/completion-scripts/
title: 'Completion Scripts'
description: Deprecation of direct completion scripts in Task’s Git directory
outline: deep
---
# Completion Scripts
:::warning
::: danger
This deprecation breaks the following functionality:
@@ -19,7 +21,5 @@ the future as the scripts may be moved or deleted entirely. Any configuration
should be updated to use the [new method for generating shell
completions][completions] instead.
{/* prettier-ignore-start */}
[completions]: ../installation.mdx#setup-completions
[completions]: /docs/installation#setup-completions
[task]: https://github.com/go-task/task
{/* prettier-ignore-end */}

View File

@@ -1,6 +1,9 @@
---
slug: /deprecations/
sidebar_position: 8
title: Deprecations
description:
Guide to deprecated features in Task and how to migrate to the new
alternatives
outline: deep
---
# Deprecations

View File

@@ -1,10 +1,14 @@
---
slug: /deprecations/template-functions/
title: 'Template Functions'
description:
Deprecation of some templating functions in Task, with guidance on their
replacements.
outline: deep
---
# Template Functions
:::warning
::: danger
This deprecation breaks the following functionality:

View File

@@ -0,0 +1,24 @@
---
# This is a template for deprecation documentation
# Copy this page and fill in the details as necessary
title: '--- Template ---'
description: Template for documenting deprecated features in Task
draft: true # Hide in production
outline: deep
---
# {Name of Deprecated Feature} (#{Issue})
::: danger
This deprecation breaks the following functionality:
- {list any existing functionality that will be broken by this deprecation}
- {if there are no breaking changes, remove this admonition}
:::
{Short description of the feature/behavior and why it is being deprecated}
{Short explanation of any replacement features/behaviors and how users should
migrate to it}

View File

@@ -1,10 +1,12 @@
---
slug: /deprecations/version-2-schema/
title: 'Version 2 Schema (#1197)'
description: Deprecation of Taskfile schema version 2 and migration to version 3
outline: deep
---
# Version 2 Schema (#1197)
:::warning
::: danger
This deprecation breaks the following functionality:
@@ -26,8 +28,6 @@ main branch. To use a more recent version of Task, you will need to ensure that
your Taskfile uses the version 3 schema instead. A list of changes between
version 2 and version 3 are available in the [Task v3 Release Notes][v3.0.0].
{/* prettier-ignore-start */}
[v3.0.0]: https://github.com/go-task/task/releases/tag/v3.0.0
[v3.33.0]: https://github.com/go-task/task/releases/tag/v3.33.0
[deprecation-notice]: https://github.com/go-task/task/issues/1197
{/* prettier-ignore-end */}

View File

@@ -1,10 +1,13 @@
---
slug: '/experiments/env-precedence'
title: 'Env Precedence (#1038)'
description:
Experiment to change the precedence of environment variables in Task
outline: deep
---
# Env Precedence (#1038)
:::caution
::: warning
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
@@ -12,7 +15,7 @@ environment. They are intended for testing and feedback only.
:::
:::warning
::: danger
This experiment breaks the following functionality:
@@ -23,8 +26,9 @@ This experiment breaks the following functionality:
::: info
To enable this experiment, set the environment variable:
`TASK_X_ENV_PRECEDENCE=1`. Check out [our guide to enabling
experiments][enabling-experiments] for more information.
`TASK_X_ENV_PRECEDENCE=1`. Check out
[our guide to enabling experiments](./index.md#enabling-experiments) for more
information.
:::
@@ -44,11 +48,12 @@ tasks:
cmds:
- echo "$KEY"
```
Running `KEY=some task` before this experiment, the output would be `some`, but
after this experiment, the output would be `other`.
If you still want to get the OS variable, you can use the template function env
like follow : `{{env "OS_VAR"}}`.
like follow : <span v-pre>`{{env "OS_VAR"}}`</span>.
```yml
version: '3'
@@ -61,14 +66,12 @@ tasks:
- echo "$KEY"
- echo {{env "KEY"}}
```
Running `KEY=some task`, the output would be `other` and `some`.
Like other variables/envs, you can also fall back to a given value using the
default template function:
```yml
MY_ENV: '{{.MY_ENV | default "fallback"}}'
```
{/* prettier-ignore-start */}
[enabling-experiments]: ./experiments.mdx#enabling-experiments
{/* prettier-ignore-end */}

View File

@@ -1,10 +1,12 @@
---
slug: /experiments/gentle-force/
title: 'Gentle Force (#1200)'
description: Experiment to modify the behavior of the --force flag in Task
outline: deep
---
# Gentle Force (#1200)
:::caution
::: warning
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
@@ -12,7 +14,7 @@ environment. They are intended for testing and feedback only.
:::
:::warning
::: danger
This experiment breaks the following functionality:
@@ -23,8 +25,9 @@ This experiment breaks the following functionality:
::: info
To enable this experiment, set the environment variable:
`TASK_X_GENTLE_FORCE=1`. Check out [our guide to enabling experiments
][enabling-experiments] for more information.
`TASK_X_GENTLE_FORCE=1`. Check out
[our guide to enabling experiments](./index.md#enabling-experiments) for more
information.
:::
@@ -43,7 +46,3 @@ If you want to migrate, but continue to force all dependant tasks to run, you
should replace all uses of the `--force` flag with `--force-all`. Alternatively,
if you want to adopt the new behavior, you can continue to use the `--force`
flag as you do now!
{/* prettier-ignore-start */}
[enabling-experiments]: ./experiments.mdx#enabling-experiments
{/* prettier-ignore-end */}

View File

@@ -1,14 +1,12 @@
---
slug: /experiments/
sidebar_position: 7
title: Experiments
description: Guide to Task’s experimental features and how to use them
outline: deep
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Experiments
:::caution
::: warning
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
@@ -46,37 +44,36 @@ Which method you use depends on how you intend to use the experiment:
`.bashrc`, `.zshrc` etc.). This will permanently enable experimental features
for your personal environment.
```shell title="~/.bashrc"
```shell
# ~/.bashrc
export TASK_X_FEATURE=1
```
3. Creating a `.env` or a `.taskrc.yml` file in the same directory as
your root Taskfile.\
The `.env` file should contain the relevant environment
variable(s), while the `.taskrc.yml` file should use a YAML format
where each experiment is defined as a key with a corresponding value.
3. Creating a `.env` or a `.taskrc.yml` file in the same directory as your root
Taskfile.\
The `.env` file should contain the relevant environment variable(s), while
the `.taskrc.yml` file should use a YAML format where each experiment is
defined as a key with a corresponding value.
This allows you to enable an experimental feature at a project level. If you
commit this file to source control, then other users of your project will
also have these experiments enabled.
If both files are present, the values in the `.taskrc.yml` file
will take precedence.
If both files are present, the values in the `.taskrc.yml` file will take
precedence.
<Tabs values={[ {label: '.taskrc.yml', value: 'yaml'}, {label: '.env', value: 'env'}]}>
<TabItem value="yaml">
```yaml title=".taskrc.yml"
::: code-group
```yaml [.taskrc.yml]
experiments:
FEATURE: 1
```
</TabItem>
<TabItem value="env">
```shell title=".env"
```shell [.env]
TASK_X_FEATURE=1
```
</TabItem>
</Tabs>
:::
## Workflow
@@ -112,7 +109,7 @@ the status will be updated via the `status: draft` label. This indicates that an
implementation is now available for use in a release and the experiment is open
for feedback.
:::note
::: info
During the draft period, major changes to the implementation may be made based
on the feedback received from users. There are _no stability guarantees_ and
@@ -139,13 +136,13 @@ version.
### 5. Released
When making a new major release of Task, all experiments marked as `status:
stable` will move to `status: released` and their behaviors will become the new
default in Task. Experiments in an earlier stage (i.e. not stable) cannot be
released and so will continue to be experiments in the new version.
When making a new major release of Task, all experiments marked as
`status: stable` will move to `status: released` and their behaviors will become
the new default in Task. Experiments in an earlier stage (i.e. not stable)
cannot be released and so will continue to be experiments in the new version.
### Abandoned / Superseded
If an experiment is unsuccessful at any point then it will be given the `status:
abandoned` or `status: superseded` labels depending on which is more suitable.
These experiments will be removed from Task.
If an experiment is unsuccessful at any point then it will be given the
`status: abandoned` or `status: superseded` labels depending on which is more
suitable. These experiments will be removed from Task.

View File

@@ -1,13 +1,12 @@
---
slug: /experiments/remote-taskfiles/
title: 'Remote Taskfiles (#1317)'
description: Experimentation for using Taskfiles stored in remote locations
outline: deep
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Remote Taskfiles (#1317)
:::caution
::: warning
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
@@ -18,13 +17,16 @@ environment. They are intended for testing and feedback only.
::: info
To enable this experiment, set the environment variable:
`TASK_X_REMOTE_TASKFILES=1`. Check out [our guide to enabling experiments
][enabling-experiments] for more information.
`TASK_X_REMOTE_TASKFILES=1`. Check out
[our guide to enabling experiments](./index.md#enabling-experiments) for more
information.
:::
::: danger
Never run remote Taskfiles from sources that you do not trust.
:::
This experiment allows you to use Taskfiles which are stored in remote
@@ -34,19 +36,35 @@ when including Taskfiles.
Task uses "nodes" to reference remote Taskfiles. There are a few different types
of node which you can use:
<Tabs groupId="method" queryString>
<TabItem value="http" label="HTTP/HTTPS">
::: code-group
```text [HTTP/HTTPS]
https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
```
```text [Git over HTTP]
https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
```
```text [Git over SSH]
git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
```
:::
## Node Types
### HTTP/HTTPS
`https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml`
This is the most basic type of remote node and works by downloading the file
from the specified URL. The file must be a valid Taskfile and can be of any
name. If a file is not found at the specified URL, Task will append each of the
[supported file names][supported-file-names] in turn until it finds a valid
file. If it still does not find a valid Taskfile, an error is returned.
supported file names in turn until it finds a valid file. If it still does not
find a valid Taskfile, an error is returned.
</TabItem>
<TabItem value="git-http" label="Git over HTTP">
### Git over HTTP
`https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main`
@@ -57,11 +75,10 @@ This is the same URL that you would use to clone the repo over HTTP.
- You can optionally add the path to the Taskfile in the repository by appending
`//<path>` to the URL.
- You can also optionally specify a branch or tag to use by appending
`?ref=<ref>` to the end of the URL. If you omit a reference, the default branch
will be used.
`?ref=<ref>` to the end of the URL. If you omit a reference, the default
branch will be used.
</TabItem>
<TabItem value="git-ssh" label="Git over SSH">
### Git over SSH
`git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main`
@@ -75,14 +92,11 @@ SSH keys added so that they can be used during authentication.
- You can optionally add the path to the Taskfile in the repository by appending
`//<path>` to the URL.
- You can also optionally specify a branch or tag to use by appending
`?ref=<ref>` to the end of the URL. If you omit a reference, the default branch
will be used.
`?ref=<ref>` to the end of the URL. If you omit a reference, the default
branch will be used.
</TabItem>
</Tabs>
Task has an [example remote Taskfile][example-remote-taskfile] in our repository
that you can use for testing and that we will use throughout this document:
Task has an example remote Taskfile in our repository that you can use for
testing and that we will use throughout this document:
```yaml
version: '3'
@@ -99,34 +113,32 @@ tasks:
## Specifying a remote entrypoint
By default, Task will look for one of the [supported file
names][supported-file-names] on your local filesystem. If you want to use a
remote file instead, you can pass its URI into the `--taskfile`/`-t` flag just
like you would to specify a different local file. For example:
By default, Task will look for one of the supported file names on your local
filesystem. If you want to use a remote file instead, you can pass its URI into
the `--taskfile`/`-t` flag just like you would to specify a different local
file. For example:
<Tabs groupId="method" queryString>
<TabItem value="http" label="HTTP/HTTPS">
```shell
::: code-group
```shell [HTTP/HTTPS]
$ task --taskfile https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
task: [hello] echo "Hello Task!"
Hello Task!
```
</TabItem>
<TabItem value="git-http" label="Git over HTTP">
```shell
```shell [Git over HTTP]
$ task --taskfile https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
task: [hello] echo "Hello Task!"
Hello Task!
```
</TabItem>
<TabItem value="git-ssh" label="Git over SSH">
```shell
```shell [Git over SSH]
$ task --taskfile git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
task: [hello] echo "Hello Task!"
Hello Task!
```
</TabItem>
</Tabs>
:::
## Including remote Taskfiles
@@ -134,32 +146,30 @@ Including a remote file works exactly the same way that including a local file
does. You just need to replace the local path with a remote URI. Any tasks in
the remote Taskfile will be available to run from your main Taskfile.
<Tabs groupId="method" queryString>
<TabItem value="http" label="HTTP/HTTPS">
```yaml
::: code-group
```yaml [HTTP/HTTPS]
version: '3'
includes:
my-remote-namespace: https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
```
</TabItem>
<TabItem value="git-http" label="Git over HTTP">
```yaml
```yaml [Git over HTTP]
version: '3'
includes:
my-remote-namespace: https://github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
```
</TabItem>
<TabItem value="git-ssh" label="Git over SSH">
```yaml
```yaml [Git over SSH]
version: '3'
includes:
my-remote-namespace: git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
```
</TabItem>
</Tabs>
:::
```shell
$ task my-remote-namespace:hello
@@ -247,9 +257,8 @@ Task currently supports both `http` and `https` URLs. However, the `http`
requests will not execute by default unless you run the task with the
`--insecure` flag. This is to protect you from accidentally running a remote
Taskfile that is downloaded via an unencrypted connection. Sources that are not
protected by TLS are vulnerable to [man-in-the-middle
attacks][man-in-the-middle-attacks] and should be avoided unless you know what
you are doing.
protected by TLS are vulnerable to man-in-the-middle attacks and should be
avoided unless you know what you are doing.
## Caching & Running Offline
@@ -273,18 +282,11 @@ the `--timeout` flag and specifying a duration. For example, `--timeout 5s` will
set the timeout to 5 seconds.
By default, the cache is stored in the Task temp directory, represented by the
`TASK_TEMP_DIR` [environment variable](../reference/environment.mdx) You can
override the location of the cache by setting the `TASK_REMOTE_DIR` environment
variable. This way, you can share the cache between different projects.
`TASK_TEMP_DIR` environment variable. You can override the location of the cache
by setting the `TASK_REMOTE_DIR` environment variable. This way, you can share
the cache between different projects.
You can force Task to ignore the cache and download the latest version
by using the `--download` flag.
You can force Task to ignore the cache and download the latest version by using
the `--download` flag.
You can use the `--clear-cache` flag to clear all cached remote files.
{/* prettier-ignore-start */}
[enabling-experiments]: ./experiments.mdx#enabling-experiments
[man-in-the-middle-attacks]: https://en.wikipedia.org/wiki/Man-in-the-middle_attack
[supported-file-names]: https://taskfile.dev/usage/#supported-file-names
[example-remote-taskfile]: https://raw.githubusercontent.com/go-task/task/main/website/static/Taskfile.yml
{/* prettier-ignore-end */}

View File

@@ -1,14 +1,10 @@
---
# This is a template for an experiments documentation
# Copy this page and fill in the details as necessary
title: '--- Template ---'
sidebar_position: -1 # Always push to the top
draft: true # Hide in production
---
# \{Name of Experiment\} (#\{Issue\})
:::caution
::: warning
All experimental features are subject to breaking changes and/or removal _at any
time_. We strongly recommend that you do not use these features in a production
@@ -37,6 +33,4 @@ information.
\{Short explanation of how users should migrate to the new behavior\}
{/* prettier-ignore-start */}
[enabling-experiments]: ./experiments.mdx#enabling-experiments
{/* prettier-ignore-end */}
[enabling-experiments]: /docs/experiments/#enabling-experiments

View File

@@ -1,6 +1,9 @@
---
slug: /faq/
sidebar_position: 15
title: FAQ
description:
Frequently asked questions about Task, including ETAs, shell limitations, and
Windows compatibility
outline: deep
---
# FAQ
@@ -24,7 +27,7 @@ be patient and avoid asking for ETAs.
The best way to speed things up is to contribute to the project yourself. We
always appreciate new contributors. If you are interested in contributing, check
out the [contributing guide](./contributing.mdx).
out the [contributing guide](./contributing.md).
## Why won't my task update my shell environment?
@@ -101,8 +104,9 @@ The default shell on Windows (`cmd` and `powershell`) do not have commands like
If you want to make your Taskfile fully cross-platform, you'll need to work
around this limitation using one of the following methods:
- Use the `{{OS}}` function to run an OS-specific script.
- Use something like `{{if eq OS "windows"}}powershell {{end}}<my_cmd>` to
- Use the <span v-pre>`{{OS}}`</span> function to run an OS-specific script.
- Use something like
<span v-pre>`{{if eq OS "windows"}}powershell {{end}}<my_cmd>`</span> to
detect windows and run the command in Powershell directly.
- Use a shell on Windows that supports these commands as builtins, such as [Git
Bash][git-bash] or [WSL][wsl].
@@ -114,7 +118,5 @@ this work. Constructive comments and contributions are very welcome!
- [mvdan/sh#93](https://github.com/mvdan/sh/issues/93)
- [mvdan/sh#97](https://github.com/mvdan/sh/issues/97)
{/* prettier-ignore-start */}
[git-bash]: https://gitforwindows.org/
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/install
{/* prettier-ignore-end */}

View File

@@ -1,14 +1,14 @@
---
slug: /getting-started/
sidebar_position: 3
title: Getting Started
description: Guide for getting started with Task
outline: deep
---
# Getting Started
The following guide will help introduce you to the basics of Task. We'll cover
how to create a Taskfile, how to write a basic task and how to call it. If you
haven't installed Task yet, head over to our [installation
guide][installation].
haven't installed Task yet, head over to our [installation guide](installation).
## Creating your first Taskfile
@@ -35,7 +35,7 @@ task --init Custom.yml
This will create a Taskfile that looks something like this:
```yaml
```yaml [Taskfile.yml]
version: '3'
vars:
@@ -48,11 +48,11 @@ tasks:
silent: true
```
As you can see, all Taskfiles are written in [YAML format][yaml]. The `version`
attribute specifies the minimum version of Task that can be used to run this
file. The `vars` attribute is used to define variables that can be used in
tasks. In this case, we are creating a string variable called `GREETING` with a
value of `Hello, World!`.
As you can see, all Taskfiles are written in [YAML format](https://yaml.org/).
The `version` attribute specifies the minimum version of Task that can be used
to run this file. The `vars` attribute is used to define variables that can be
used in tasks. In this case, we are creating a string variable called `GREETING`
with a value of `Hello, World!`.
Finally, the `tasks` attribute is used to define the tasks that can be run. In
this case, we have a task called `default` that echoes the value of the
@@ -70,10 +70,10 @@ task default
```
Note that we don't have to specify the name of the Taskfile. Task will
automatically look for a file called `Taskfile.yml` (or any of Task's [supported
file names][supported-file-names]) in the current directory. Additionally, tasks
with the name `default` are special. They can also be run without specifying the
task name.
automatically look for a file called `Taskfile.yml` (or any of Task's
[supported file names](/docs/guide#supported-file-names)) in the current directory.
Additionally, tasks with the name `default` are special. They can also be run
without specifying the task name.
If you created a Taskfile in a different directory, you can run it by passing
the absolute or relative path to the directory as an argument using the `--dir`
@@ -96,10 +96,10 @@ Let's create a task to build a program in Go. Start by adding a new task called
`build` below the existing `default` task. We can then add a `cmds` attribute
with a single command to build the program.
Task uses [mvdan/sh][mvdan/sh], a native Go sh interpreter. So you can write
sh/bash-like commands - even in environments where `sh` or `bash` are usually
not available (like Windows). Just remember any executables called must be
available as a built-in or in the system's `PATH`.
Task uses [mvdan/sh](https://github.com/mvdan/sh), a native Go sh interpreter.
So you can write sh/bash-like commands - even in environments where `sh` or
`bash` are usually not available (like Windows). Just remember any executables
called must be available as a built-in or in the system's `PATH`.
When you're done, it should look something like this:
@@ -128,16 +128,6 @@ task build
That's about it for the basics, but there's _so much_ more that you can do with
Task. Check out the rest of the documentation to learn more about all the
features Task has to offer! We recommend taking a look at the [usage
guide][usage] next. Alternatively, you can check out our reference docs for the
[Taskfile schema][schema] and [CLI][cli].
{/* prettier-ignore-start */}
[yaml]: https://yaml.org/
[installation]: /installation/
[supported-file-names]: /usage/#supported-file-names
[mvdan/sh]: https://github.com/mvdan/sh
[usage]: /usage/
[schema]: /reference/schema/
[cli]: /reference/cli/
{/* prettier-ignore-end */}
features Task has to offer! We recommend taking a look at the
[usage guide](/docs/guide) next. Alternatively, you can check out our reference docs
for the [Taskfile schema](reference/schema) and [CLI](reference/cli).

View File

@@ -1,12 +1,8 @@
---
slug: /usage/
sidebar_position: 4
outline: deep
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Usage
# Guide
## Running Taskfiles
@@ -39,11 +35,12 @@ the file tree until it finds one (similar to how `git` works). When running Task
from a subdirectory like this, it will behave as if you ran it from the
directory containing the Taskfile.
You can use this functionality along with the special `{{.USER_WORKING_DIR}}`
variable to create some very useful reusable tasks. For example, if you have a
monorepo with directories for each microservice, you can `cd` into a
microservice directory and run a task command to bring it up without having to
create multiple tasks or Taskfiles with identical content. For example:
You can use this functionality along with the special
<span v-pre>`{{.USER_WORKING_DIR}}`</span> variable to create some very useful
reusable tasks. For example, if you have a monorepo with directories for each
microservice, you can `cd` into a microservice directory and run a task command
to bring it up without having to create multiple tasks or Taskfiles with
identical content. For example:
```yaml
version: '3'
@@ -74,9 +71,9 @@ This is useful to have automation that you can run from anywhere in your system!
When running your global Taskfile with `-g`, tasks will run on `$HOME` by
default, and not on your working directory!
As mentioned in the previous section, the `{{.USER_WORKING_DIR}}` special
variable can be very handy here to run stuff on the directory you're calling
`task -g` from.
As mentioned in the previous section, the
<span v-pre>`{{.USER_WORKING_DIR}}`</span> special variable can be very handy
here to run stuff on the directory you're calling `task -g` from.
```yaml
version: '3'
@@ -151,15 +148,19 @@ variables, as you can see in the [Variables](#variables) section.
You can also ask Task to include `.env` like files by using the `dotenv:`
setting:
```shell title=".env"
::: code-group
```shell [.env]
KEYNAME=VALUE
```
```shell title="testing/.env"
```shell [testing/.env]
ENDPOINT=testing.com
```
```yaml title="Taskfile.yml"
:::
```yaml
version: '3'
env:
@@ -305,14 +306,13 @@ includes:
### Flatten includes
You can flatten the included Taskfile tasks into the main Taskfile by using the `flatten` option.
It means that the included Taskfile tasks will be available without the namespace.
You can flatten the included Taskfile tasks into the main Taskfile by using the
`flatten` option. It means that the included Taskfile tasks will be available
without the namespace.
::: code-group
<Tabs defaultValue="1">
<TabItem value="1" label="Taskfile.yml">
```yaml
```yaml [Taskfile.yml]
version: '3'
includes:
@@ -327,10 +327,7 @@ tasks:
- task: foo
```
</TabItem>
<TabItem value="2" label="Included.yml">
```yaml
```yaml [Included.yml]
version: '3'
tasks:
@@ -339,8 +336,7 @@ tasks:
- echo "Foo"
```
</TabItem>
</Tabs>
:::
If you run `task -a` it will print :
@@ -352,7 +348,8 @@ task: Available tasks for this project:
You can run `task foo` directly without the namespace.
You can also reference the task in other tasks without the namespace. So if you run `task greet` it will run `greet` and `foo` tasks and the output will be :
You can also reference the task in other tasks without the namespace. So if you
run `task greet` it will run `greet` and `foo` tasks and the output will be :
```text
Greet
@@ -361,10 +358,9 @@ Foo
If multiple tasks have the same name, an error will be thrown:
<Tabs defaultValue="1">
<TabItem value="1" label="Taskfile.yml">
::: code-group
```yaml
```yaml [Taskfile.yml]
version: '3'
includes:
lib:
@@ -378,10 +374,7 @@ tasks:
- task: foo
```
</TabItem>
<TabItem value="2" label="Included.yml">
```yaml
```yaml [Included.yml]
version: '3'
tasks:
@@ -390,27 +383,28 @@ tasks:
- echo "Foo"
```
</TabItem>
</Tabs>
:::
If you run `task -a` it will print:
```text
task: Found multiple tasks (greet) included by "lib"
```
If the included Taskfile has a task with the same name as a task in the main Taskfile,
you may want to exclude it from the flattened tasks.
If the included Taskfile has a task with the same name as a task in the main
Taskfile, you may want to exclude it from the flattened tasks.
You can do this by using the [`excludes` option](#exclude-tasks-from-being-included).
You can do this by using the
[`excludes` option](#exclude-tasks-from-being-included).
### Exclude tasks from being included
You can exclude tasks from being included by using the `excludes` option. This option takes the list of tasks to be excluded from this include.
You can exclude tasks from being included by using the `excludes` option. This
option takes the list of tasks to be excluded from this include.
<Tabs defaultValue="1">
<TabItem value="1" label="Taskfile.yml">
::: code-group
```yaml
```yaml [Taskfile.yml]
version: '3'
includes:
included:
@@ -418,10 +412,7 @@ version: '3'
excludes: [foo]
```
</TabItem>
<TabItem value="2" label="Included.yml">
```yaml
```yaml [Included.yml]
version: '3'
tasks:
@@ -429,9 +420,10 @@ tasks:
bar: echo "Bar"
```
</TabItem></Tabs>
:::
`task included:foo` will throw an error because the `foo` task is excluded but `task included:bar` will work and display `Bar`.
`task included:foo` will throw an error because the `foo` task is excluded but
`task included:bar` will work and display `Bar`.
It's compatible with the `flatten` option.
@@ -476,7 +468,7 @@ Vars declared in the included Taskfile have preference over the variables in the
including Taskfile! If you want a variable in an included Taskfile to be
overridable, use the
[default function](https://go-task.github.io/slim-sprig/defaults.html):
`MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`.
<span v-pre>`MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`</span>.
:::
@@ -785,7 +777,6 @@ instead of its checksum (content), just set the `method` property to
At the task level for a specific task:
```yaml
version: '3'
@@ -817,7 +808,6 @@ tasks:
- app{{exeExt}}
```
In situations where you need more flexibility the `status` keyword can be used.
You can even combine the two. See the documentation for
[status](#using-programmatic-checks-to-indicate-a-task-is-up-to-date) for an
@@ -896,12 +886,14 @@ tasks that generate remote artifacts (Docker images, deploys, CD releases) the
checksum source and timestamps require either access to the artifact or for an
out-of-band refresh of the `.checksum` fingerprint file.
Two special variables `{{.CHECKSUM}}` and `{{.TIMESTAMP}}` are available for
interpolation within `cmds` and `status` commands, depending on the method assigned to
fingerprint the sources. Only `source` globs are fingerprinted.
Two special variables <span v-pre>`{{.CHECKSUM}}`</span> and
<span v-pre>`{{.TIMESTAMP}}`</span> are available for interpolation within
`cmds` and `status` commands, depending on the method assigned to fingerprint
the sources. Only `source` globs are fingerprinted.
Note that the `{{.TIMESTAMP}}` variable is a "live" Go `time.Time` struct, and
can be formatted using any of the methods that `time.Time` responds to.
Note that the <span v-pre>`{{.TIMESTAMP}}`</span> variable is a "live" Go
`time.Time` struct, and can be formatted using any of the methods that
`time.Time` responds to.
See [the Go Time documentation](https://golang.org/pkg/time/) for more
information.
@@ -909,8 +901,8 @@ information.
You can use `--force` or `-f` if you want to force a task to run even when
up-to-date.
Also, `task --status [tasks]...` will exit with a non-zero [exit
code](/reference/cli#exit-codes) if any of the tasks are not up-to-date.
Also, `task --status [tasks]...` will exit with a non-zero
[exit code](/docs/reference/cli#exit-codes) if any of the tasks are not up-to-date.
`status` can be combined with the
[fingerprinting](#by-fingerprinting-locally-generated-files-and-their-sources)
@@ -1050,7 +1042,7 @@ requires:
vars: [] # Array of strings
```
:::note
::: info
Variables set to empty zero length strings, will pass the `requires` check.
@@ -1073,11 +1065,16 @@ tasks:
### Ensuring required variables have allowed values
If you want to ensure that a variable is set to one of a predefined set of valid values before executing a task, you can use requires.
This is particularly useful when there are strict requirements for what values a variable can take, and you want to provide clear feedback to the user when an invalid value is detected.
If you want to ensure that a variable is set to one of a predefined set of valid
values before executing a task, you can use requires. This is particularly
useful when there are strict requirements for what values a variable can take,
and you want to provide clear feedback to the user when an invalid value is
detected.
To use `requires`, you specify an array of allowed values in the vars sub-section under requires. Task will check if the variable is set to one of the allowed values.
If the variable does not match any of these values, the task will raise an error and stop execution.
To use `requires`, you specify an array of allowed values in the vars
sub-section under requires. Task will check if the variable is set to one of the
allowed values. If the variable does not match any of these values, the task
will raise an error and stop execution.
This check applies both to user-defined variables and environment variables.
@@ -1099,7 +1096,7 @@ tasks:
If `ENV` is not one of 'dev', 'beta' or 'prod' an error will be raised.
:::note
::: info
This is supported only for string variables.
@@ -1117,7 +1114,7 @@ variable types are supported:
- `array`
- `map`
:::note
::: info
Defining a map requires that you use a special `map` subkey (see example below).
@@ -1213,8 +1210,9 @@ Example of a `default` value to be overridden from CLI:
```yaml
version: '3'
tasks:
greet_user:
desc: "Greet the user with a name."
desc: 'Greet the user with a name.'
vars:
USER_NAME: '{{.USER_NAME| default "DefaultUser"}}'
cmds:
@@ -1252,15 +1250,14 @@ This works for all types of variables.
### Referencing other variables
Templating is great for referencing string values if you want to pass
a value from one task to another. However, the templating engine is only able to
output strings. If you want to pass something other than a string to another
task then you will need to use a reference (`ref`) instead.
Templating is great for referencing string values if you want to pass a value
from one task to another. However, the templating engine is only able to output
strings. If you want to pass something other than a string to another task then
you will need to use a reference (`ref`) instead.
<Tabs defaultValue="2">
<TabItem value="1" label="Templating Engine">
::: code-group
```yaml
```yaml [Templating Engine]
version: 3
tasks:
@@ -1276,10 +1273,7 @@ tasks:
- 'echo {{index .FOO 0}}' # <-- FOO is a string so the task outputs '91' which is the ASCII code for '[' instead of the expected 'A'
```
</TabItem>
<TabItem value="2" label="Reference">
```yaml
```yaml [Reference]
version: 3
tasks:
@@ -1296,11 +1290,10 @@ tasks:
- 'echo {{index .FOO 0}}' # <-- FOO is still a map so the task outputs 'A' as expected
```
</TabItem>
</Tabs>
:::
This also works the same way when calling `deps` and when defining
a variable and can be used in any combination:
This also works the same way when calling `deps` and when defining a variable
and can be used in any combination:
```yaml
version: 3
@@ -1357,7 +1350,7 @@ tasks:
vars:
JSON: '{"a": 1, "b": 2, "c": 3}'
FOO:
ref: "fromJson .JSON"
ref: 'fromJson .JSON'
cmds:
- echo {{.FOO}}
```
@@ -1402,9 +1395,11 @@ tasks:
cmds:
- for:
matrix:
OS: ["windows", "linux", "darwin"]
ARCH: ["amd64", "arm64"]
cmd: echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}"
OS: ['windows', 'linux', 'darwin']
ARCH: ['amd64', 'arm64']
cmd:
echo "<span v-pre>{{.ITEM.OS}}</span>/<span
v-pre>{{.ITEM.ARCH}}</span>"
```
This will output:
@@ -1421,11 +1416,11 @@ darwin/arm64
You can also use references to other variables as long as they are also lists:
```yaml
version: "3"
version: '3'
vars:
OS_VAR: ["windows", "linux", "darwin"]
ARCH_VAR: ["amd64", "arm64"]
OS_VAR: ['windows', 'linux', 'darwin']
ARCH_VAR: ['amd64', 'arm64']
tasks:
default:
@@ -1436,7 +1431,9 @@ tasks:
ref: .OS_VAR
ARCH:
ref: .ARCH_VAR
cmd: echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}"
cmd:
echo "<span v-pre>{{.ITEM.OS}}</span>/<span
v-pre>{{.ITEM.ARCH}}</span>"
```
### Looping over your task's sources or generated files
@@ -1444,10 +1441,9 @@ tasks:
You are also able to loop over the sources of your task or the files it
generates:
<Tabs defaultValue="1" groupId="sources-generates">
<TabItem value="1" label="Sources">
::: code-group
```yaml
```yaml [Sources]
version: '3'
tasks:
@@ -1460,10 +1456,7 @@ tasks:
cmd: cat {{ .ITEM }}
```
</TabItem>
<TabItem value="2" label="Generates">
```yaml
```yaml [Generates]
version: '3'
tasks:
@@ -1476,8 +1469,7 @@ tasks:
cmd: cat {{ .ITEM }}
```
</TabItem>
</Tabs>
:::
This will also work if you use globbing syntax in `sources` or `generates`. For
example, if you specify a source for `*.txt`, the loop will iterate over all
@@ -1485,50 +1477,45 @@ files that match that glob.
Paths will always be returned as paths relative to the task directory. If you
need to convert this to an absolute path, you can use the built-in `joinPath`
function. There are some [special
variables](/reference/templating/#special-variables) that you may find useful
for this.
function. There are some
[special variables](/docs/reference/templating#special-variables) that you may find
useful for this.
<Tabs defaultValue="1" groupId="sources-generates">
<TabItem value="1" label="Sources">
::: code-group
```yaml
```yaml [Sources]
version: '3'
tasks:
default:
vars:
MY_DIR: /path/to/dir
dir: '{{.MY_DIR}}'
dir: '<span v-pre>{{.MY_DIR}}</span>'
sources:
- foo.txt
- bar.txt
cmds:
- for: sources
cmd: cat {{joinPath .MY_DIR .ITEM}}
cmd: cat <span v-pre>{{joinPath .MY_DIR .ITEM}}</span>
```
</TabItem>
<TabItem value="2" label="Generates">
```yaml
```yaml [Generates]
version: '3'
tasks:
default:
vars:
MY_DIR: /path/to/dir
dir: '{{.MY_DIR}}'
dir: '<span v-pre>{{.MY_DIR}}</span>'
generates:
- foo.txt
- bar.txt
cmds:
- for: generates
cmd: cat {{joinPath .MY_DIR .ITEM}}
cmd: cat <span v-pre>{{joinPath .MY_DIR .ITEM}}</span>
```
</TabItem>
</Tabs>
:::
### Looping over variables
@@ -1545,7 +1532,7 @@ tasks:
MY_VAR: foo.txt bar.txt
cmds:
- for: { var: MY_VAR }
cmd: cat {{.ITEM}}
cmd: cat <span v-pre>{{.ITEM}}</span>
```
If you need to split a string on a different character, you can do this by
@@ -1560,7 +1547,7 @@ tasks:
MY_VAR: foo.txt,bar.txt
cmds:
- for: { var: MY_VAR, split: ',' }
cmd: cat {{.ITEM}}
cmd: cat <span v-pre>{{.ITEM}}</span>
```
You can also loop over arrays and maps directly:
@@ -1575,12 +1562,12 @@ tasks:
cmds:
- for:
var: LIST
cmd: echo {{.ITEM}}
cmd: echo <span v-pre>{{.ITEM}}</span>
```
When looping over a map we also make an additional `{{.KEY}}` variable available
that holds the string value of the map key. Remember that maps are unordered, so
the order in which the items are looped over is random.
When looping over a map we also make an additional <span v-pre>`{{.KEY}}`</span>
variable available that holds the string value of the map key. Remember that
maps are unordered, so the order in which the items are looped over is random.
All of this also works with dynamic variables!
@@ -1594,7 +1581,7 @@ tasks:
sh: find -type f -name '*.txt'
cmds:
- for: { var: MY_VAR }
cmd: cat {{.ITEM}}
cmd: cat <span v-pre>{{.ITEM}}</span>
```
### Renaming variables
@@ -1611,7 +1598,7 @@ tasks:
MY_VAR: foo.txt bar.txt
cmds:
- for: { var: MY_VAR, as: FILE }
cmd: cat {{.FILE}}
cmd: cat <span v-pre>{{.FILE}}</span>
```
### Looping over tasks
@@ -1629,11 +1616,11 @@ tasks:
- for: [foo, bar]
task: my-task
vars:
FILE: '{{.ITEM}}'
FILE: '<span v-pre>{{.ITEM}}</span>'
my-task:
cmds:
- echo '{{.FILE}}'
- echo '<span v-pre>{{.FILE}}</span>'
```
Or if you want to run different tasks depending on the value of the loop:
@@ -1645,7 +1632,7 @@ tasks:
default:
cmds:
- for: [foo, bar]
task: task-{{.ITEM}}
task: task-<span v-pre>{{.ITEM}}</span>
task-foo:
cmds:
@@ -1670,11 +1657,11 @@ tasks:
- for: [foo, bar]
task: my-task
vars:
FILE: '{{.ITEM}}'
FILE: '<span v-pre>{{.ITEM}}</span>'
my-task:
cmds:
- echo '{{.FILE}}'
- echo '<span v-pre>{{.FILE}}</span>'
```
It is important to note that as `deps` are run in parallel, the order in which
@@ -1710,7 +1697,7 @@ version: '3'
tasks:
yarn:
cmds:
- yarn {{.CLI_ARGS}}
- yarn <span v-pre>{{.CLI_ARGS}}</span>
```
## Wildcard arguments
@@ -1731,16 +1718,17 @@ version: '3'
tasks:
start:*:*:
vars:
SERVICE: "{{index .MATCH 0}}"
REPLICAS: "{{index .MATCH 1}}"
SERVICE: '<span v-pre>{{index .MATCH 0}}</span>'
REPLICAS: '<span v-pre>{{index .MATCH 1}}</span>'
cmds:
- echo "Starting {{.SERVICE}} with {{.REPLICAS}} replicas"
- echo "Starting <span v-pre>{{.SERVICE}}</span> with <span
v-pre>{{.REPLICAS}}</span> replicas"
start:*:
vars:
SERVICE: "{{index .MATCH 0}}"
SERVICE: '<span v-pre>{{index .MATCH 0}}</span>'
cmds:
- echo "Starting {{.SERVICE}}"
- echo "Starting <span v-pre>{{.SERVICE}}</span>"
```
This call matches the `start:*` task and the string "foo" is captured by the
@@ -1813,7 +1801,7 @@ commands are executed in the reverse order if you schedule multiple of them.
:::
A special variable `.EXIT_CODE` is exposed when a command exited with a non-zero
[exit code](/reference/cli#exit-codes). You can check its presence to know if
[exit code](/docs/reference/cli#exit-codes). You can check its presence to know if
the task completed successfully or not:
```yaml
@@ -1822,7 +1810,10 @@ version: '3'
tasks:
default:
cmds:
- defer: echo '{{if .EXIT_CODE}}Failed with {{.EXIT_CODE}}!{{else}}Success!{{end}}'
- defer:
echo '<span v-pre>{{if .EXIT_CODE}}</span>Failed with <span
v-pre>{{.EXIT_CODE}}</span>!<span v-pre>{{else}}</span>Success!<span
v-pre>{{end}}</span>'
- exit 1
```
@@ -1944,6 +1935,7 @@ version: '3'
tasks:
default:
cmds:
- task: print
vars:
MESSAGE: hello
@@ -1952,9 +1944,9 @@ tasks:
MESSAGE: world
print:
label: 'print-{{.MESSAGE}}'
label: 'print-<span v-pre>{{.MESSAGE}}</span>'
cmds:
- echo "{{.MESSAGE}}"
- echo "<span v-pre>{{.MESSAGE}}</span>"
```
## Warning Prompts
@@ -2013,7 +2005,7 @@ tasks:
```
Warning prompts are called before executing a task. If a prompt is denied Task
will exit with [exit code](/reference/cli#exit-codes) 205. If approved, Task
will exit with [exit code](/docs/reference/cli#exit-codes) 205. If approved, Task
will continue as normal.
```shell
@@ -2029,7 +2021,7 @@ To skip warning prompts automatically, you can use the `--yes` (alias `-y`)
option when calling the task. By including this option, all warnings, will be
automatically confirmed, and no prompts will be shown.
:::caution
::: warning
Tasks with prompts always fail by default on non-terminal environments, like a
CI, where an `stdin` won't be available for the user to answer. In those cases,
@@ -2197,7 +2189,7 @@ version: '3'
output:
group:
begin: '::group::{{.TASK}}'
begin: '::group::<span v-pre>{{.TASK}}</span>'
end: '::endgroup::'
tasks:
@@ -2260,8 +2252,8 @@ tasks:
print:
cmds:
- echo "{{.TEXT}}"
prefix: 'print-{{.TEXT}}'
- echo "<span v-pre>{{.TEXT}}</span>"
prefix: 'print-<span v-pre>{{.TEXT}}</span>'
silent: true
```
@@ -2310,11 +2302,11 @@ the default settings (e.g. no custom `env:`, `vars:`, `desc:`, `silent:` , etc):
version: '3'
tasks:
build: go build -v -o ./app{{exeExt}} .
build: go build -v -o ./app<span v-pre>{{exeExt}}</span> .
run:
- task: build
- ./app{{exeExt}} -h localhost -p 8080
- ./app<span v-pre>{{exeExt}}</span> -h localhost -p 8080
```
## `set` and `shopt`
@@ -2351,9 +2343,9 @@ which files to watch.
The default watch interval is 100 milliseconds, but it's possible to change it
by either setting `interval: '500ms'` in the root of the Taskfile or by passing
it as an argument like `--interval=500ms`.
This interval is the time Task will wait for duplicated events. It will only run
the task again once, even if multiple changes happen within the interval.
it as an argument like `--interval=500ms`. This interval is the time Task will
wait for duplicated events. It will only run the task again once, even if
multiple changes happen within the interval.
Also, it's possible to set `watch: true` in a given task and it'll automatically
run in watch mode:
@@ -2381,13 +2373,12 @@ if called by another task, either directly or as a dependency.
:::
:::caution
::: warning
The watcher can misbehave in certain scenarios, in particular for long-running
servers.
There is a known bug where child processes of the running might not be killed
appropriately. It's adviced to avoid running commands as `go run` and prefer
`go build [...] && ./binary` instead.
servers. There is a known bug where child processes of the running might not be
killed appropriately. It's advised to avoid running commands as `go run` and
prefer `go build [...] && ./binary` instead.
If you are having issues, you might want to try tools specifically designed for
live-reloading, like [Air](https://github.com/air-verse/air/). Also, be sure to
@@ -2396,7 +2387,5 @@ to us.
:::
{/* prettier-ignore-start */}
[gotemplate]: https://golang.org/pkg/text/template/
[templating-reference]: ./reference/templating.mdx
{/* prettier-ignore-end */}
[templating-reference]: /docs/reference/templating

View File

@@ -0,0 +1,323 @@
---
title: Installation
description: Installation methods for Task
outline: deep
---
# Installation
Task offers many installation methods. Check out the available methods below.
::: info
Some of the methods below are marked as
![Community](https://img.shields.io/badge/Community%20Owned-orange). This means
they are not maintained by the Task team and may not be up-to-date.
:::
## Package Managers
### [Homebrew](https://brew.sh) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) {#homebrew}
Task is available via our official Homebrew tap
[[source](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)]:
```shell
brew install go-task/tap/go-task
```
Alternatively it can be installed from the official Homebrew repository
[[package](https://formulae.brew.sh/formula/go-task)]
[[source](https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/go-task.rb)]
by running:
```shell
brew install go-task
```
### [Macports](https://macports.org) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#macports}
Task repository is tracked by Macports
[[package](https://ports.macports.org/port/go-task/details/)]
[[source](https://github.com/macports/macports-ports/blob/master/devel/go-task/Portfile)]:
```shell
port install go-task
```
### [Snap](https://snapcraft.io/task) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) {#snap}
Task is available on [Snapcraft](https://snapcraft.io/task)
[[source](https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml)], but
keep in mind that your Linux distribution should allow classic confinement for
Snaps to Task work correctly:
```shell
sudo snap install task --classic
```
### [npm](https://www.npmjs.com) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) {#npm}
Npm can be used as cross-platform way to install Task globally or as a
dependency of your project
[[package](https://www.npmjs.com/package/@go-task/cli)]
[[source](https://github.com/go-task/task/blob/main/package.json)]:
```shell
npm install -g @go-task/cli
```
### [pip](https://pip.pypa.io) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pip}
Like npm, pip can be used as a cross-platform way to install Task
[[package](https://pypi.org/project/go-task-bin)]
[[source](https://github.com/Bing-su/pip-binary-factory/tree/main/task)]:
```shell
pip install go-task-bin
```
### [WinGet](https://github.com/microsoft/winget-cli) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) {#winget}
Task is available via the
[community repository](https://github.com/microsoft/winget-pkgs)
[[source](https://github.com/microsoft/winget-pkgs/tree/master/manifests/t/Task/Task)]:
```shell
winget install Task.Task
```
### [Chocolatey](https://chocolatey.org) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#chocolatey}
[[package](https://community.chocolatey.org/packages/go-task)]
[[source](https://github.com/Starz0r/ChocolateyPackagingScripts/blob/master/src/go-task_gh_build.py)]
```shell
choco install go-task
```
### [Scoop](https://scoop.sh) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#scoop}
[[source](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)]
```shell
scoop install task
```
### Arch ([pacman](https://wiki.archlinux.org/title/Pacman)) ![Arch Linux](https://img.shields.io/badge/Arch%20Linux-1793D1?logo=arch-linux&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#arch}
[[package](https://archlinux.org/packages/extra/x86_64/go-task/)]
[[source](https://gitlab.archlinux.org/archlinux/packaging/packages/go-task)]
```shell
pacman -S go-task
```
### Fedora ([dnf](https://docs.fedoraproject.org/en-US/quick-docs/dnf)) ![Fedora](https://img.shields.io/badge/Fedora-51A2DA?logo=fedora&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#fedora}
[[package](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)]
[[source](https://src.fedoraproject.org/rpms/golang-github-task)]
```shell
dnf install go-task
```
### FreeBSD ([Ports](https://ports.freebsd.org/cgi/ports.cgi)) ![FreeBSD](https://img.shields.io/badge/FreeBSD-990000?logo=freebsd&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#freebsd}
[[package](https://cgit.freebsd.org/ports/tree/devel/task)]
[[source](https://cgit.freebsd.org/ports/tree/devel/task/Makefile)]
```shell
pkg install task
```
### NixOS ([nix](https://nixos.org)) ![NixOS](https://img.shields.io/badge/NixOS-5277C3?logo=nixos&logoColor=fff) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#nix}
[[source](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/go/go-task/package.nix)]
```shell
nix-env -iA nixpkgs.go-task
```
### [pacstall](https://github.com/pacstall/pacstall) ![Debian](https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=fff) ![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pacstall}
[[package](https://pacstall.dev/packages/go-task-deb)]
[[source](https://github.com/pacstall/pacstall-programs/blob/master/packages/go-task-deb/go-task-deb.pacscript)]
```shell
pacstall -I go-task-deb
```
### [pkgx](https://pkgx.sh) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pkgx}
[[package](https://pkgx.dev/pkgs/taskfile.dev)]
[[source](https://github.com/pkgxdev/pantry/blob/main/projects/taskfile.dev/package.yml)]
```shell
pkgx task
```
or, if you have pkgx integration enabled:
```shell
task
```
## Get The Binary
### Binary
You can download the binary from the
[releases page on GitHub](https://github.com/go-task/task/releases) and add to
your `$PATH`.
DEB and RPM packages are also available.
The `task_checksums.txt` file contains the SHA-256 checksum for each file.
### Install Script
We also have an
[install script](https://github.com/go-task/task/blob/main/install-task.sh)
which is very useful in scenarios like CI. Many thanks to
[GoDownloader](https://github.com/goreleaser/godownloader) for enabling the easy
generation of this script.
By default, it installs on the `./bin` directory relative to the working
directory:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
```
It is possible to override the installation directory with the `-b` parameter.
On Linux, common choices are `~/.local/bin` and `~/bin` to install for the
current user or `/usr/local/bin` to install for all users:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
```
::: warning
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by
default.
:::
By default, it installs the latest version available. You can also specify a tag
(available in [releases](https://github.com/go-task/task/releases)) to install a
specific version:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d v3.36.0
```
Parameters are order specific, to set both installation directory and version:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin v3.42.1
```
### GitHub Actions
If you want to install Task in GitHub Actions you can try using
[this action](https://github.com/arduino/setup-task) by the Arduino team:
```yaml
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
```
This installation method is community owned.
## Build From Source
### Go Modules
Ensure that you have a supported version of [Go](https://golang.org) properly
installed and setup. You can find the minimum required version of Go in the
[go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file.
You can then install the latest release globally by running:
```shell
go install github.com/go-task/task/v3/cmd/task@latest
```
Or you can install into another directory:
```shell
env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
```
::: tip
For CI environments we recommend using the [install script](#install-script)
instead, which is faster and more stable, since it'll just download the latest
released binary.
:::
## Setup completions
Some installation methods will automatically install completions too, but if
this isn't working for you or your chosen method doesn't include them, you can
run `task --completion <shell>` to output a completion script for any supported
shell. There are a couple of ways these completions can be added to your shell
config:
### Option 1. Load the completions in your shell's startup config (Recommended)
This method loads the completion script from the currently installed version of
task every time you create a new shell. This ensures that your completions are
always up-to-date.
::: code-group
```shell [bash]
# ~/.bashrc
eval "$(task --completion bash)"
```
```shell [zsh]
# ~/.zshrc
eval "$(task --completion zsh)"
```
```shell [fish]
# ~/.config/fish/config.fish
task --completion fish | source
```
```powershell [powershell]
# $PROFILE\Microsoft.PowerShell_profile.ps1
Invoke-Expression (&task --completion powershell | Out-String)
```
:::
### Option 2. Copy the script to your shell's completions directory
This method requires you to manually update the completions whenever Task is
updated. However, it is useful if you want to modify the completions yourself.
::: code-group
```shell [bash]
task --completion bash > /etc/bash_completion.d/task
```
```shell [zsh]
task --completion zsh > /usr/local/share/zsh/site-functions/_task
```
```shell [fish]
task --completion fish > ~/.config/fish/completions/task.fish
```
:::

View File

@@ -1,6 +1,9 @@
---
slug: /integrations/
sidebar_position: 9
title: Integrations
description:
Official and community integrations for Task, including VS Code, JSON schemas,
and other tools
outline: deep
---
# Integrations

View File

@@ -0,0 +1,343 @@
---
title: CLI Reference
description: Complete reference for Task CLI commands, flags, and exit codes
permalink: /reference/cli/
outline: deep
---
# Command Line Interface
Task CLI commands have the following syntax:
```bash
task [options] [tasks...] [-- CLI_ARGS...]
```
::: tip
If `--` is given, all remaining arguments will be assigned to a special
`CLI_ARGS` variable
:::
## Commands
### `task [tasks...]`
Run one or more tasks defined in your Taskfile.
```bash
task build
task test lint
task deploy --force
```
### `task --list`
List all available tasks with their descriptions.
```bash
task --list
task -l
```
### `task --list-all`
List all tasks, including those without descriptions.
```bash
task --list-all
task -a
```
### `task --init`
Create a new Taskfile.yml in the current directory.
```bash
task --init
task -i
```
## Options
### General
#### `-h, --help`
Show help information.
```bash
task --help
```
#### `--version`
Show Task version.
```bash
task --version
```
#### `-v, --verbose`
Enable verbose mode for detailed output.
```bash
task build --verbose
```
#### `-s, --silent`
Disable command echoing.
```bash
task deploy --silent
```
### Execution Control
#### `-f, --force`
Force execution even when the task is up-to-date.
```bash
task build --force
```
#### `-n, --dry`
Compile and print tasks without executing them.
```bash
task deploy --dry
```
#### `-p, --parallel`
Execute multiple tasks in parallel.
```bash
task test lint --parallel
```
#### `-C, --concurrency <number>`
Limit the number of concurrent tasks. Zero means unlimited.
```bash
task test --concurrency 4
```
#### `-x, --exit-code`
Pass through the exit code of failed commands.
```bash
task test --exit-code
```
### File and Directory
#### `-d, --dir <path>`
Set the directory where Task will run and look for Taskfiles.
```bash
task build --dir ./backend
```
#### `-t, --taskfile <file>`
Specify a custom Taskfile path.
```bash
task build --taskfile ./custom/Taskfile.yml
```
#### `-g, --global`
Run the global Taskfile from `$HOME/Taskfile.{yml,yaml}`.
```bash
task backup --global
```
### Output Control
#### `-o, --output <mode>`
Set output style. Available modes: `interleaved`, `group`, `prefixed`.
```bash
task test --output group
```
#### `--output-group-begin <template>`
Message template to print before grouped output.
```bash
task test --output group --output-group-begin "::group::{{.TASK}}"
```
#### `--output-group-end <template>`
Message template to print after grouped output.
```bash
task test --output group --output-group-end "::endgroup::"
```
#### `--output-group-error-only`
Only show command output on non-zero exit codes.
```bash
task test --output group --output-group-error-only
```
#### `-c, --color`
Control colored output. Enabled by default.
```bash
task build --color=false
# or use environment variable
NO_COLOR=1 task build
```
### Task Information
#### `--status`
Check if tasks are up-to-date without running them.
```bash
task build --status
```
#### `--summary`
Show detailed information about a task.
```bash
task build --summary
```
#### `--json`
Output task information in JSON format (use with `--list` or `--list-all`).
```bash
task --list --json
```
#### `--sort <mode>`
Change task listing order. Available modes: `default`, `alphanumeric`, `none`.
```bash
task --list --sort alphanumeric
```
### Watch Mode
#### `-w, --watch`
Watch for file changes and re-run tasks automatically.
```bash
task build --watch
```
#### `-I, --interval <duration>`
Set watch interval (default: `5s`). Must be a valid
[Go duration](https://pkg.go.dev/time#ParseDuration).
```bash
task build --watch --interval 1s
```
### Interactive
#### `-y, --yes`
Automatically answer "yes" to all prompts.
```bash
task deploy --yes
```
## Exit Codes
Task uses specific exit codes to indicate different types of errors:
### Success
- **0** - Success
### General Errors (1-99)
- **1** - Unknown error occurred
### Taskfile Errors (100-199)
- **100** - No Taskfile found
- **101** - Taskfile already exists (when using `--init`)
- **102** - Invalid or unparseable Taskfile
- **103** - Remote Taskfile download failed
- **104** - Remote Taskfile not trusted
- **105** - Remote Taskfile fetch not secure
- **106** - No cache for remote Taskfile in offline mode
- **107** - No schema version defined in Taskfile
### Task Errors (200-255)
- **200** - Task not found
- **201** - Command execution error
- **202** - Attempted to run internal task
- **203** - Multiple tasks with same name/alias
- **204** - Task called too many times (recursion limit)
- **205** - Task cancelled by user
- **206** - Missing required variables
- **207** - Variable has incorrect value
::: info
When using `-x/--exit-code`, failed command exit codes are passed through
instead of the above codes.
:::
::: tip
The complete list of exit codes is available in the repository at
[`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
:::
## JSON Output Format
When using `--json` with `--list` or `--list-all`:
```json
{
"tasks": [
{
"name": "build",
"task": "build",
"desc": "Build the application",
"summary": "Compiles the source code and generates binaries",
"up_to_date": false,
"location": {
"line": 12,
"column": 3,
"taskfile": "/path/to/Taskfile.yml"
}
}
],
"location": "/path/to/Taskfile.yml"
}
```

View File

@@ -1,6 +1,6 @@
---
slug: /reference/package
sidebar_position: 2
title: CLI Reference
description: Complete reference for Task CLI commands, flags, and exit codes
---
# Package API
@@ -39,9 +39,11 @@ fetching and executing tasks from a Taskfile. At this time, the vast majority of
the this package's functionality is exposed via the [`task.Executor`] which
allows the user to fetch and execute tasks from a Taskfile.
:::note
::: info
This is the package which is most likely to be the subject of breaking changes
as we refine the API.
:::
### [`github.com/go-task/task/v3/taskfile`]
@@ -136,32 +138,44 @@ tf, err := tfg.Merge()
This compiles the DAG into a single [`ast.Taskfile`] containing all the
namespaces and tasks from all the Taskfiles we read.
:::note
::: info
We plan to remove AST merging in the future as it is unnecessarily complex and
causes lots of issues with scoping.
:::
{/* prettier-ignore-start */}
[`github.com/go-task/task/v3`]: https://pkg.go.dev/github.com/go-task/task/v3
[`github.com/go-task/task/v3/taskfile`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile
[`github.com/go-task/task/v3/taskfile/ast`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast
[`github.com/go-task/task/v3/errors`]: https://pkg.go.dev/github.com/go-task/task/v3/errors
[`ast.TaskfileGraph`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#TaskfileGraph
[`ast.Taskfile`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#Taskfile
[`github.com/go-task/task/v3/taskfile`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile
[`github.com/go-task/task/v3/taskfile/ast`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast
[`github.com/go-task/task/v3/errors`]:
https://pkg.go.dev/github.com/go-task/task/v3/errors
[`ast.TaskfileGraph`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#TaskfileGraph
[`ast.Taskfile`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#Taskfile
[`taskfile.Node`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Node
[`taskfile.FileNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#FileNode
[`taskfile.HTTPNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#HTTPNode
[`taskfile.GitNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#GitNode
[`taskfile.StdinNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#StdinNode
[`taskfile.NewFileNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewFileNode
[`taskfile.Reader`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Reader
[`taskfile.NewReader`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewReader
[`taskfile.Snippet`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Snippet
[`taskfile.FileNode`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#FileNode
[`taskfile.HTTPNode`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#HTTPNode
[`taskfile.GitNode`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#GitNode
[`taskfile.StdinNode`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#StdinNode
[`taskfile.NewFileNode`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewFileNode
[`taskfile.Reader`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Reader
[`taskfile.NewReader`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewReader
[`taskfile.Snippet`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Snippet
[`task.Executor`]: https://pkg.go.dev/github.com/go-task/task/v3#Executor
[`task.Formatter`]: https://pkg.go.dev/github.com/go-task/task/v3#Formatter
[`errors.TaskError`]: https://pkg.go.dev/github.com/go-task/task/v3/errors#TaskError
[`errors.TaskError`]:
https://pkg.go.dev/github.com/go-task/task/v3/errors#TaskError
[`error`]: https://pkg.go.dev/builtin#error
[ast]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
{/* prettier-ignore-end */}

View File

@@ -0,0 +1,840 @@
---
title: Schema Reference
description:
Complete reference for the Taskfile schema based on the official JSON schema
outline: deep
---
# Schema Reference
This page documents all available properties and types for the Taskfile schema
version 3, based on the
[official JSON schema](https://taskfile.dev/schema.json).
## Root Schema
The root Taskfile schema defines the structure of your main `Taskfile.yml`.
### `version`
- **Type**: `string` or `number`
- **Required**: Yes
- **Valid values**: `"3"`, `3`, or any valid semver string
- **Description**: Version of the Taskfile schema
```yaml
version: '3'
```
### `output`
- **Type**: `string` or `object`
- **Default**: `interleaved`
- **Options**: `interleaved`, `group`, `prefixed`
- **Description**: Controls how task output is displayed
```yaml
# Simple string format
output: group
# Advanced object format
output:
group:
begin: "::group::{{.TASK}}"
end: "::endgroup::"
error_only: false
```
### `method`
- **Type**: `string`
- **Default**: `checksum`
- **Options**: `checksum`, `timestamp`, `none`
- **Description**: Default method for checking if tasks are up-to-date
```yaml
method: timestamp
```
### [`includes`](#include)
- **Type**: `map[string]Include`
- **Description**: Include other Taskfiles
```yaml
includes:
# Simple string format
docs: ./Taskfile.yml
# Full object format
backend:
taskfile: ./backend
dir: ./backend
optional: false
flatten: false
internal: false
aliases: [api]
excludes: [internal-task]
vars:
SERVICE_NAME: backend
checksum: abc123...
```
### [`vars`](#variable)
- **Type**: `map[string]Variable`
- **Description**: Global variables available to all tasks
```yaml
vars:
# Simple values
APP_NAME: myapp
VERSION: 1.0.0
DEBUG: true
PORT: 8080
FEATURES: [auth, logging]
# Dynamic variables
COMMIT_HASH:
sh: git rev-parse HEAD
# Variable references
BUILD_VERSION:
ref: VERSION
# Map variables
CONFIG:
map:
database: postgres
cache: redis
```
### `env`
- **Type**: `map[string]Variable`
- **Description**: Global environment variables
```yaml
env:
NODE_ENV: production
DATABASE_URL:
sh: echo $DATABASE_URL
```
### [`tasks`](#task)
- **Type**: `map[string]Task`
- **Description**: Task definitions
```yaml
tasks:
# Simple string format
hello: echo "Hello World"
# Array format
build:
- go mod tidy
- go build ./...
# Full object format
deploy:
desc: Deploy the application
cmds:
- ./scripts/deploy.sh
```
### `silent`
- **Type**: `bool`
- **Default**: `false`
- **Description**: Suppress task name and command output by default
```yaml
silent: true
```
### `dotenv`
- **Type**: `[]string`
- **Description**: Load environment variables from .env files
```yaml
dotenv:
- .env
- .env.local
```
### `run`
- **Type**: `string`
- **Default**: `always`
- **Options**: `always`, `once`, `when_changed`
- **Description**: Default execution behavior for tasks
```yaml
run: once
```
### `interval`
- **Type**: `string`
- **Default**: `100ms`
- **Pattern**: `^[0-9]+(?:m|s|ms)$`
- **Description**: Watch interval for file changes
```yaml
interval: 1s
```
### `set`
- **Type**: `[]string`
- **Options**: `allexport`, `a`, `errexit`, `e`, `noexec`, `n`, `noglob`, `f`,
`nounset`, `u`, `xtrace`, `x`, `pipefail`
- **Description**: POSIX shell options for all commands
```yaml
set: [errexit, nounset, pipefail]
```
### `shopt`
- **Type**: `[]string`
- **Options**: `expand_aliases`, `globstar`, `nullglob`
- **Description**: Bash shell options for all commands
```yaml
shopt: [globstar]
```
## Include
Configuration for including external Taskfiles.
### `taskfile`
- **Type**: `string`
- **Required**: Yes
- **Description**: Path to the Taskfile or directory to include
```yaml
includes:
backend: ./backend/Taskfile.yml
# Shorthand for above
frontend: ./frontend
```
### `dir`
- **Type**: `string`
- **Description**: Working directory for included tasks
```yaml
includes:
api:
taskfile: ./api
dir: ./api
```
### `optional`
- **Type**: `bool`
- **Default**: `false`
- **Description**: Don't error if the included file doesn't exist
```yaml
includes:
optional-tasks:
taskfile: ./optional.yml
optional: true
```
### `flatten`
- **Type**: `bool`
- **Default**: `false`
- **Description**: Include tasks without namespace prefix
```yaml
includes:
common:
taskfile: ./common.yml
flatten: true
```
### `internal`
- **Type**: `bool`
- **Default**: `false`
- **Description**: Hide included tasks from command line and `--list`
```yaml
includes:
internal:
taskfile: ./internal.yml
internal: true
```
### `aliases`
- **Type**: `[]string`
- **Description**: Alternative names for the namespace
```yaml
includes:
database:
taskfile: ./db.yml
aliases: [db, data]
```
### `excludes`
- **Type**: `[]string`
- **Description**: Tasks to exclude from inclusion
```yaml
includes:
shared:
taskfile: ./shared.yml
excludes: [internal-setup, debug-only]
```
### `vars`
- **Type**: `map[string]Variable`
- **Description**: Variables to pass to the included Taskfile
```yaml
includes:
deploy:
taskfile: ./deploy.yml
vars:
ENVIRONMENT: production
```
### `checksum`
- **Type**: `string`
- **Description**: Expected checksum of the included file
```yaml
includes:
remote:
taskfile: https://example.com/tasks.yml
checksum: c153e97e0b3a998a7ed2e61064c6ddaddd0de0c525feefd6bba8569827d8efe9
```
## Variable
Variables support multiple types and can be static values, dynamic commands,
references, or maps.
### Static Variables
```yaml
vars:
# String
APP_NAME: myapp
# Number
PORT: 8080
# Boolean
DEBUG: true
# Array
FEATURES: [auth, logging, metrics]
# Null
OPTIONAL_VAR: null
```
### Dynamic Variables (`sh`)
```yaml
vars:
COMMIT_HASH:
sh: git rev-parse HEAD
BUILD_TIME:
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
```
### Variable References (`ref`)
```yaml
vars:
BASE_VERSION: 1.0.0
FULL_VERSION:
ref: BASE_VERSION
```
### Map Variables (`map`)
```yaml
vars:
CONFIG:
map:
database:
host: localhost
port: 5432
cache:
type: redis
ttl: 3600
```
### Variable Ordering
Variables can reference previously defined variables:
```yaml
vars:
GREETING: Hello
TARGET: World
MESSAGE: '{{.GREETING}} {{.TARGET}}!'
```
## Task
Individual task configuration with multiple syntax options.
### Simple Task Formats
```yaml
tasks:
# String command
hello: echo "Hello World"
# Array of commands
build:
- go mod tidy
- go build ./...
# Object with cmd shorthand
test:
cmd: go test ./...
```
### Task Properties
#### `cmds`
- **Type**: `[]Command`
- **Description**: Commands to execute
```yaml
tasks:
build:
cmds:
- go build ./...
- echo "Build complete"
```
#### `cmd`
- **Type**: `string`
- **Description**: Single command (alternative to `cmds`)
```yaml
tasks:
test:
cmd: go test ./...
```
#### `deps`
- **Type**: `[]Dependency`
- **Description**: Tasks to run before this task
```yaml
tasks:
# Simple dependencies
deploy:
deps: [build, test]
cmds:
- ./deploy.sh
# Dependencies with variables
advanced-deploy:
deps:
- task: build
vars:
ENVIRONMENT: production
- task: test
vars:
COVERAGE: true
cmds:
- ./deploy.sh
# Silent dependencies
main:
deps:
- task: setup
silent: true
cmds:
- echo "Main task"
# Loop dependencies
test-all:
deps:
- for: [unit, integration, e2e]
task: test
vars:
TEST_TYPE: '{{.ITEM}}'
cmds:
- echo "All tests completed"
```
#### `desc`
- **Type**: `string`
- **Description**: Short description shown in `--list`
```yaml
tasks:
test:
desc: Run unit tests
cmds:
- go test ./...
```
#### `summary`
- **Type**: `string`
- **Description**: Detailed description shown in `--summary`
```yaml
tasks:
deploy:
desc: Deploy to production
summary: |
Deploy the application to production environment.
This includes building, testing, and uploading artifacts.
```
#### `prompt`
- **Type**: `string` or `[]string`
- **Description**: Prompts shown before task execution
```yaml
tasks:
deploy:
prompt: "Deploy to production?"
# or multiple prompts
prompt:
- "Are you sure?"
- "This will affect live users!"
```
#### `aliases`
- **Type**: `[]string`
- **Description**: Alternative names for the task
```yaml
tasks:
build:
aliases: [compile, make]
cmds:
- go build ./...
```
#### `sources`
- **Type**: `[]string` or `[]Glob`
- **Description**: Source files to monitor for changes
```yaml
tasks:
build:
sources:
- '**/*.go'
- go.mod
# With exclusions
- exclude: '**/*_test.go'
cmds:
- go build ./...
```
#### `generates`
- **Type**: `[]string` or `[]Glob`
- **Description**: Files generated by this task
```yaml
tasks:
build:
sources: ['**/*.go']
generates:
- './app'
- exclude: '*.debug'
cmds:
- go build -o app ./cmd
```
#### `status`
- **Type**: `[]string`
- **Description**: Commands to check if task should run
```yaml
tasks:
install-deps:
status:
- test -f node_modules/.installed
cmds:
- npm install
- touch node_modules/.installed
```
#### `preconditions`
- **Type**: `[]Precondition`
- **Description**: Conditions that must be met before running
```yaml
tasks:
# Simple precondition (shorthand)
build:
preconditions:
- test -f ./src
cmds:
- go build ./...
# Preconditions with custom messages
deploy:
preconditions:
- sh: test -n "$API_KEY"
msg: 'API_KEY environment variable is required'
- sh: test -f ./app
msg: "Application binary not found. Run 'task build' first."
cmds:
- ./deploy.sh
```
#### `requires`
- **Type**: `Requires`
- **Description**: Required variables with optional enums
```yaml
tasks:
# Simple requirements
deploy:
requires:
vars: [API_KEY, ENVIRONMENT]
cmds:
- ./deploy.sh
# Requirements with enum validation
advanced-deploy:
requires:
vars:
- API_KEY
- name: ENVIRONMENT
enum: [development, staging, production]
- name: LOG_LEVEL
enum: [debug, info, warn, error]
cmds:
- echo "Deploying to {{.ENVIRONMENT}} with log level {{.LOG_LEVEL}}"
- ./deploy.sh
```
#### `watch`
- **Type**: `bool`
- **Default**: `false`
- **Description**: Automatically run task in watch mode
```yaml
tasks:
dev:
watch: true
cmds:
- npm run dev
```
#### `platforms`
- **Type**: `[]string`
- **Description**: Platforms where this task should run
```yaml
tasks:
windows-build:
platforms: [windows]
cmds:
- go build -o app.exe ./cmd
unix-build:
platforms: [linux, darwin]
cmds:
- go build -o app ./cmd
```
## Command
Individual command configuration within a task.
### Basic Commands
```yaml
tasks:
example:
cmds:
- echo "Simple command"
- ls -la
```
### Command Object
```yaml
tasks:
example:
cmds:
- cmd: echo "Hello World"
silent: true
ignore_error: false
platforms: [linux, darwin]
set: [errexit]
shopt: [globstar]
```
### Task References
```yaml
tasks:
example:
cmds:
- task: other-task
vars:
PARAM: value
silent: false
```
### Deferred Commands
```yaml
tasks:
with-cleanup:
cmds:
- echo "Starting work"
# Deferred command string
- defer: echo "Cleaning up"
# Deferred task reference
- defer:
task: cleanup-task
vars:
CLEANUP_MODE: full
```
### For Loops
#### Loop Over List
```yaml
tasks:
greet-all:
cmds:
- for: [alice, bob, charlie]
cmd: echo "Hello {{.ITEM}}"
```
#### Loop Over Sources/Generates
```yaml
tasks:
process-files:
sources: ['*.txt']
cmds:
- for: sources
cmd: wc -l {{.ITEM}}
- for: generates
cmd: gzip {{.ITEM}}
```
#### Loop Over Variable
```yaml
tasks:
process-items:
vars:
ITEMS: 'item1,item2,item3'
cmds:
- for:
var: ITEMS
split: ','
as: CURRENT
cmd: echo "Processing {{.CURRENT}}"
```
#### Loop Over Matrix
```yaml
tasks:
test-matrix:
cmds:
- for:
matrix:
OS: [linux, windows, darwin]
ARCH: [amd64, arm64]
cmd: echo "Testing {{.OS}}/{{.ARCH}}"
```
#### Loop in Dependencies
```yaml
tasks:
build-all:
deps:
- for: [frontend, backend, worker]
task: build
vars:
SERVICE: '{{.ITEM}}'
```
## Shell Options
### Set Options
Available `set` options for POSIX shell features:
- `allexport` / `a` - Export all variables
- `errexit` / `e` - Exit on error
- `noexec` / `n` - Read commands but don't execute
- `noglob` / `f` - Disable pathname expansion
- `nounset` / `u` - Error on undefined variables
- `xtrace` / `x` - Print commands before execution
- `pipefail` - Pipe failures propagate
```yaml
# Global level
set: [errexit, nounset, pipefail]
tasks:
debug:
# Task level
set: [xtrace]
cmds:
- cmd: echo "This will be traced"
# Command level
set: [noexec]
```
### Shopt Options
Available `shopt` options for Bash features:
- `expand_aliases` - Enable alias expansion
- `globstar` - Enable `**` recursive globbing
- `nullglob` - Null glob expansion
```yaml
# Global level
shopt: [globstar]
tasks:
find-files:
# Task level
shopt: [nullglob]
cmds:
- cmd: ls **/*.go
# Command level
shopt: [globstar]
```

View File

@@ -0,0 +1,781 @@
---
title: Templating Reference
description:
Comprehensive guide to Task's templating system with Go text/template, special
variables, and available functions
outline: deep
---
# Templating Reference
Task's templating engine uses Go's
[text/template](https://pkg.go.dev/text/template) package to interpolate values.
This reference covers the main features and all available functions for creating
dynamic Taskfiles.
## Basic Usage
Most string values in Task can be templated using double curly braces
<span v-pre>`{{` and `}}`</span>. Anything inside the braces is executed as a Go
template.
### Simple Variable Interpolation
```yaml
version: '3'
tasks:
hello:
vars:
MESSAGE: 'Hello, World!'
cmds:
- 'echo {{.MESSAGE}}'
```
**Output:**
```
Hello, World!
```
### Conditional Logic
```yaml
version: '3'
tasks:
maybe-happy:
vars:
SMILE: ':\)'
FROWN: ':\('
HAPPY: true
cmds:
- 'echo {{if .HAPPY}}{{.SMILE}}{{else}}{{.FROWN}}{{end}}'
```
**Output:**
```
:)
```
### Function Calls and Pipes
```yaml
version: '3'
tasks:
uniq:
vars:
NUMBERS: '0,1,1,1,2,2,3'
cmds:
- 'echo {{splitList "," .NUMBERS | uniq | join ", "}}'
```
**Output:**
```
0, 1, 2, 3
```
### Control Flow with Loops
```yaml
version: '3'
tasks:
loop:
vars:
NUMBERS: [0, 1, 1, 1, 2, 2, 3]
cmds:
- |
{{range $index, $num := .NUMBERS}}
{{if gt $num 1}}{{break}}{{end}}
echo {{$index}}: {{$num}}
{{end}}
```
**Output:**
```
0: 0
1: 1
2: 1
3: 1
```
## Special Variables
Task provides special variables that are always available in templates. These
override any user-defined variables with the same name.
### CLI
#### `CLI_ARGS`
- **Type**: `string`
- **Description**: All extra arguments passed after `--` as a string
```yaml
tasks:
test:
cmds:
- go test {{.CLI_ARGS}}
```
```bash
task test -- -v -race
# Runs: go test -v -race
```
#### `CLI_ARGS_LIST`
- **Type**: `[]string`
- **Description**: All extra arguments passed after `--` as a shell parsed list
```yaml
tasks:
docker-run:
cmds:
- docker run {{range .CLI_ARGS_LIST}}{{.}} {{end}}myapp
```
#### `CLI_FORCE`
- **Type**: `bool`
- **Description**: Whether `--force` or `--force-all` flags were set
```yaml
tasks:
deploy:
cmds:
- |
{{if .CLI_FORCE}}
echo "Force deployment enabled"
{{end}}
./deploy.sh
```
#### `CLI_SILENT`
- **Type**: `bool`
- **Description**: Whether `--silent` flag was set
#### `CLI_VERBOSE`
- **Type**: `bool`
- **Description**: Whether `--verbose` flag was set
#### `CLI_OFFLINE`
- **Type**: `bool`
- **Description**: Whether `--offline` flag was set
### Task
#### `TASK`
- **Type**: `string`
- **Description**: Name of the current task
```yaml
tasks:
build:
cmds:
- echo "Running task {{.TASK}}"
```
#### `ALIAS`
- **Type**: `string`
- **Description**: Alias used for the current task, otherwise matches `TASK`
#### `TASK_EXE`
- **Type**: `string`
- **Description**: Task executable name or path
```yaml
tasks:
self-update:
cmds:
- echo "Updating {{.TASK_EXE}}"
```
### File Paths
#### `ROOT_TASKFILE`
- **Type**: `string`
- **Description**: Absolute path of the root Taskfile
#### `ROOT_DIR`
- **Type**: `string`
- **Description**: Absolute path of the root Taskfile directory
#### `TASKFILE`
- **Type**: `string`
- **Description**: Absolute path of the current (included) Taskfile
#### `TASKFILE_DIR`
- **Type**: `string`
- **Description**: Absolute path of the current Taskfile directory
#### `TASK_DIR`
- **Type**: `string`
- **Description**: Absolute path where the task is executed
#### `USER_WORKING_DIR`
- **Type**: `string`
- **Description**: Absolute path where `task` was called from
```yaml
tasks:
info:
cmds:
- echo "Root {{.ROOT_DIR}}"
- echo "Current {{.TASKFILE_DIR}}"
- echo "Working {{.USER_WORKING_DIR}}"
```
### Status
#### `CHECKSUM`
- **Type**: `string`
- **Description**: Checksum of files in `sources` (only in `status` with
`checksum` method)
#### `TIMESTAMP`
- **Type**: `time.Time`
- **Description**: Greatest timestamp of files in `sources` (only in `status`
with `timestamp` method)
```yaml
tasks:
build:
method: checksum
sources: ['**/*.go']
status:
- test "{{.CHECKSUM}}" = "$(cat .last-checksum)"
cmds:
- go build ./...
- echo "{{.CHECKSUM}}" > .last-checksum
```
### Loop
#### `ITEM`
- **Type**: `any`
- **Description**: Current iteration value when using `for` property
```yaml
tasks:
greet:
cmds:
- for: [alice, bob, charlie]
cmd: echo "Hello {{.ITEM}}"
```
Can be renamed using `as`:
```yaml
tasks:
greet:
cmds:
- for:
var: NAMES
as: NAME
cmd: echo "Hello {{.NAME}}"
```
### Defer
#### `EXIT_CODE`
- **Type**: `int`
- **Description**: Failed command exit code (only in `defer`, only when
non-zero)
```yaml
tasks:
deploy:
cmds:
- ./deploy.sh
- defer: |
{{if .EXIT_CODE}}
echo "Deployment failed with code {{.EXIT_CODE}}"
./rollback.sh
{{end}}
```
### System
#### `TASK_VERSION`
- **Type**: `string`
- **Description**: Current version of Task
```yaml
tasks:
version:
cmds:
- echo "Using Task {{.TASK_VERSION}}"
```
## Available Functions
Task provides a comprehensive set of functions for templating. Functions can be chained using pipes (`|`) and combined for powerful templating capabilities.
### Logic and Control Flow
#### `and`, `or`, `not`
Boolean operations for conditional logic
```yaml
tasks:
conditional:
vars:
DEBUG: true
VERBOSE: false
PRODUCTION: false
cmds:
- echo "{{if and .DEBUG .VERBOSE}}Debug mode with verbose{{end}}"
- echo "{{if or .DEBUG .VERBOSE}}Some kind of debug{{end}}"
- echo "{{if not .PRODUCTION}}Development build{{end}}"
```
#### `eq`, `ne`, `lt`, `le`, `gt`, `ge`
Comparison operations
```yaml
tasks:
compare:
vars:
VERSION: 3
cmds:
- echo "{{if gt .VERSION 2}}Version 3 or higher{{end}}"
- echo "{{if eq .VERSION 3}}Exactly version 3{{end}}"
```
### Data Access and Manipulation
#### `index`
Access array/map elements by index or key
```yaml
tasks:
access:
vars:
SERVICES: [api, web, worker]
CONFIG:
map:
database: postgres
port: 5432
cmds:
- echo "First service {{index .SERVICES 0}}"
- echo "Database {{index .CONFIG "database"}}"
```
#### `len`
Get length of arrays, maps, or strings
```yaml
tasks:
length:
vars:
ITEMS: [a, b, c, d]
TEXT: "Hello World"
cmds:
- echo "Found {{len .ITEMS}} items"
- echo "Text has {{len .TEXT}} characters"
```
#### `slice`
Extract a portion of an array or string
```yaml
tasks:
slice-demo:
vars:
ITEMS: [a, b, c, d, e]
cmds:
- echo "{{slice .ITEMS 1 3}}" # [b c]
```
### String Functions
#### Basic String Operations
```yaml
tasks:
string-basic:
vars:
MESSAGE: ' Hello World '
NAME: 'john doe'
TEXT: "Hello World"
cmds:
- echo "{{.MESSAGE | trim}}" # "Hello World"
- echo "{{.NAME | title}}" # "John Doe"
- echo "{{.NAME | upper}}" # "JOHN DOE"
- echo "{{.MESSAGE | lower}}" # "hello world"
- echo "{{.NAME | trunc 4}}" # "john"
- echo "{{"test" | repeat 3}}" # "testtesttest"
- echo "{{substr .TEXT 0 5}}" # "Hello"
```
#### String Testing and Searching
```yaml
tasks:
string-test:
vars:
FILENAME: 'app.tar.gz'
EMAIL: 'user@example.com'
cmds:
- echo "{{.FILENAME | hasPrefix "app"}}" # true
- echo "{{.FILENAME | hasSuffix ".gz"}}" # true
- echo "{{.EMAIL | contains "@"}}" # true
```
#### String Replacement and Formatting
```yaml
tasks:
string-format:
vars:
TEXT: 'Hello, World!'
UNSAFE: 'file with spaces.txt'
cmds:
- echo "{{.TEXT | replace "," ""}}" # "Hello World!"
- echo "{{.TEXT | quote}}" # "\"Hello, World!\""
- echo "{{.UNSAFE | shellQuote}}" # Shell-safe quoting
- echo "{{.UNSAFE | q}}" # Short alias for shellQuote
```
#### Regular Expressions
```yaml
tasks:
regex:
vars:
EMAIL: 'user@example.com'
TEXT: 'abc123def456'
cmds:
- echo "{{regexMatch "@" .EMAIL}}" # true
- echo "{{regexFind "[0-9]+" .TEXT}}" # "123"
- echo "{{regexFindAll "[0-9]+" .TEXT -1}}" # ["123", "456"]
- echo "{{regexReplaceAll "[0-9]+" .TEXT "X"}}" # "abcXdefX"
```
### List Functions
#### List Access and Basic Operations
```yaml
tasks:
list-basic:
vars:
ITEMS: ["apple", "banana", "cherry", "date"]
cmds:
- echo "First {{.ITEMS | first}}" # "apple"
- echo "Last {{.ITEMS | last}}" # "date"
- echo "Rest {{.ITEMS | rest}}" # ["banana", "cherry", "date"]
- echo "Initial {{.ITEMS | initial}}" # ["apple", "banana", "cherry"]
- echo "Length {{.ITEMS | len}}" # 4
```
#### List Manipulation
```yaml
tasks:
list-manipulate:
vars:
NUMBERS: [3, 1, 4, 1, 5, 9, 1]
FRUITS: ["apple", "banana"]
cmds:
- echo "{{.NUMBERS | uniq}}" # [3, 1, 4, 5, 9]
- echo "{{.NUMBERS | sortAlpha}}" # [1, 1, 1, 3, 4, 5, 9]
- echo"'{{append .FRUITS "cherry"}}"" # ["apple", "banana", "cherry"]
- echo "{{ without .NUMBERS 1}}" # [3, 4, 5, 9]
- echo "{{.NUMBERS | has 5}}" # true
```
#### String Lists
```yaml
tasks:
string-lists:
vars:
CSV: 'apple,banana,cherry'
WORDS: ['hello', 'world', 'from', 'task']
MULTILINE: |
line1
line2
line3
cmds:
- echo "{{.CSV | splitList ","}}" # ["apple", "banana", "cherry"]
- echo "{{.WORDS | join " "}}" # "hello world from task"
- echo "{{.WORDS | sortAlpha}}" # ["from", "hello", "task", "world"]
- echo "{{.MULTILINE | splitLines}}" # Split on newlines (Unix/Windows)
- echo "{{.MULTILINE | catLines}}" # Replace newlines with spaces
```
#### Shell Argument Parsing
```yaml
tasks:
shell-args:
vars:
ARGS: 'file1.txt -v --output="result file.txt"'
cmds:
- |
{{range .ARGS | splitArgs}}
echo "Arg: {{.}}"
{{end}}
```
### Math Functions
```yaml
tasks:
math:
vars:
A: 10
B: 3
NUMBERS: [1, 5, 3, 9, 2]
cmds:
- echo "Addition {{add .A .B}}" # 13
- echo "Subtraction {{sub .A .B}}" # 7
- echo "Multiplication {{mul .A .B}}" # 30
- echo "Division {{div .A .B}}" # 3
- echo "Modulo {{mod .A .B}}" # 1
- echo "Maximum {{.NUMBERS | max}}" # 9
- echo "Minimum {{.NUMBERS | min}}" # 1
- echo "Random 1-99 {{randInt 1 100}}" # Random number
- echo "Random 0-999 {{randIntN 1000}}" # Random number 0-999
```
### Date and Time Functions
```yaml
tasks:
date-time:
vars:
BUILD_DATE: "2023-12-25"
cmds:
- echo "Now {{now | date "2006-01-02 15:04:05"}}"
- echo {{ toDate "2006-01-02" .BUILD_DATE }}
- echo "Build {{.BUILD_DATE | toDate "2006-01-02" | date "Jan 2, 2006"}}"
- echo "Unix timestamp {{now | unixEpoch}}"
- echo "Duration ago {{now | ago}}"
```
### System Functions
#### Platform Information
```yaml
tasks:
platform:
cmds:
- echo "OS {{OS}}" # linux, darwin, windows, etc.
- echo "Architecture {{ARCH}}" # amd64, arm64, etc.
- echo "CPU cores {{numCPU}}" # Number of CPU cores
- echo "Building for {{OS}}/{{ARCH}}"
```
#### Path Functions
```yaml
tasks:
paths:
vars:
WIN_PATH: 'C:\Users\name\file.txt'
OUTPUT_DIR: 'dist'
BINARY_NAME: 'myapp'
cmds:
- echo "{{.WIN_PATH | toSlash}}" # Convert to forward slashes
- echo "{{.WIN_PATH | fromSlash}}" # Convert to OS-specific slashes
- echo "{{joinPath .OUTPUT_DIR .BINARY_NAME}}" # Join path elements
- echo "Relative {{relPath .ROOT_DIR .TASKFILE_DIR}}" # Get relative path
```
### Data Structure Functions
#### Dictionary Operations
```yaml
tasks:
dict:
vars:
CONFIG:
map:
database: postgres
port: 5432
ssl: true
cmds:
- echo "Database {{.CONFIG | get "database"}}"
- echo "Keys {{.CONFIG | keys}}"
- echo "Has SSL {{.CONFIG | hasKey "ssl"}}"
- echo "{{dict "env" "prod" "debug" false}}"
```
#### Merging and Combining
```yaml
tasks:
merge:
vars:
BASE_CONFIG:
map:
timeout: 30
retries: 3
USER_CONFIG:
map:
timeout: 60
debug: true
cmds:
- echo "{{merge .BASE_CONFIG .USER_CONFIG | toJson}}"
```
### Default Values and Coalescing
```yaml
tasks:
defaults:
vars:
API_URL: ""
DEBUG: false
ITEMS: []
cmds:
- echo "{{.API_URL | default "http://localhost:8080"}}"
- echo "{{.DEBUG | default true}}"
- echo "{{.MISSING_VAR | default "fallback"}}"
- echo "{{coalesce .API_URL .FALLBACK_URL "default"}}"
- echo "Is empty {{empty .ITEMS}}" # true
```
### Encoding and Serialization
#### JSON
```yaml
tasks:
json:
vars:
DATA:
map:
name: 'Task'
version: '3.0'
JSON_STRING: '{"key": "value", "number": 42}'
cmds:
- echo "{{.DATA | toJson}}"
- echo "{{.DATA | toPrettyJson}}"
- echo "{{.JSON_STRING | fromJson }}"
```
#### YAML
```yaml
tasks:
yaml:
vars:
CONFIG:
map:
database:
host: localhost
port: 5432
YAML_STRING: |
key: value
items:
- one
- two
cmds:
- echo "{{.CONFIG | toYaml}}"
- echo "{{.YAML_STRING | fromYaml}}"
```
#### Base64
```yaml
tasks:
base64:
vars:
SECRET: 'my-secret-key'
cmds:
- echo "{{.SECRET | b64enc}}" # Encode to base64
- echo "{{"bXktc2VjcmV0LWtleQ==" | b64dec}}" # Decode from base64
```
### Type Conversion
```yaml
tasks:
convert:
vars:
NUM_STR: '42'
FLOAT_STR: '3.14'
BOOL_STR: 'true'
ITEMS: [1, 2, 3]
cmds:
- echo "{{.NUM_STR | atoi | add 8}}" # String to int: 50
- echo "{{.FLOAT_STR | float64}}" # String to float: 3.14
- echo "{{.ITEMS | toStrings}}" # Convert to strings: ["1", "2", "3"]
```
### Utility Functions
#### UUID Generation
```yaml
tasks:
generate:
vars:
DEPLOYMENT_ID: "{{uuid}}"
cmds:
- echo "Deployment ID {{.DEPLOYMENT_ID}}"
```
#### Debugging
```yaml
tasks:
debug:
vars:
COMPLEX_VAR:
map:
items: [1, 2, 3]
nested:
key: value
cmds:
- echo "{{spew .COMPLEX_VAR}}" # Pretty-print for debugging
```
### Output Functions
#### Formatted Output
```yaml
tasks:
output:
vars:
VERSION: "1.2.3"
BUILD: 42
cmds:
- echo '{{print "Simple output"}}'
- echo '{{printf "Version %s.%d" .VERSION .BUILD}}'
- echo '{{println "With newline"}}'
```

View File

@@ -1,6 +1,9 @@
---
slug: /releasing/
sidebar_position: 13
title: Releasing
description:
Task release process including GoReleaser, Homebrew, npm, Snapcraft, winget,
and other package managers
outline: deep
---
# Releasing
@@ -17,18 +20,18 @@ Since v3.15.0, raw executables can also be reproduced and verified locally by
checking out a specific tag and calling `goreleaser build`, using the Go version
defined in the above GitHub Actions.
# Homebrew
## Homebrew
Goreleaser will automatically push a new commit to the
[Formula/go-task.rb][gotaskrb] file in the [Homebrew tap][homebrewtap]
repository to release the new version.
# npm
## npm
To release to npm update the version in the [`package.json`][packagejson] file
and then run `task npm:publish` to push it.
# Snapcraft
## Snapcraft
The [snap package][snappackage] requires to manual steps to release a new
version:
@@ -37,7 +40,7 @@ version:
- Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel
on the [Snapcraft dashboard][snapcraftdashboard].
# winget
## winget
winget also requires manual steps to be completed. By running
`task goreleaser:test` locally, manifest files will be generated on
@@ -46,7 +49,7 @@ winget also requires manual steps to be completed. By running
and open a pull request into
[this repository](https://github.com/microsoft/winget-pkgs).
# Scoop
## Scoop
Scoop is a command-line package manager for the Windows operating system. Scoop
package manifests are maintained by the community. Scoop owners usually take
@@ -54,19 +57,18 @@ care of updating versions there by editing
[this file](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json).
If you think its Task version is outdated, open an issue to let us know.
# Nix
## Nix
Nix is a community owned installation method. Nix package maintainers usually
take care of updating versions there by editing
[this file](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/go/go-task/package.nix).
If you think its Task version is outdated, open an issue to let us know.
{/* prettier-ignore-start */}
[goreleaser]: https://goreleaser.com/
[homebrewtap]: https://github.com/go-task/homebrew-tap
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb
[packagejson]: https://github.com/go-task/task/blob/main/package.json#L3
[snappackage]: https://github.com/go-task/snap
[snapcraftyaml]: https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml#L2
[snapcraftyaml]:
https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml#L2
[snapcraftdashboard]: https://snapcraft.io/task/releases
{/* prettier-ignore-end */}

View File

@@ -1,6 +1,9 @@
---
slug: /styleguide/
sidebar_position: 11
title: Style Guide
description:
Official style guide for Taskfile.yml files with best practices and
recommended conventions
outline: deep
---
# Style Guide

View File

@@ -1,6 +1,9 @@
---
slug: /taskfile-versions/
sidebar_position: 6
title: Taskfile Versions
description:
How to use the Taskfile schema version to ensure users are using the correct
versions of Task
outline: deep
---
# Taskfile Versions

66
website/src/donate.md Normal file
View File

@@ -0,0 +1,66 @@
---
title: Donate
layout: doc
outline: false
---
# :pray: Support Taskfile
If you find this project useful, consider supporting its ongoing development.
> This is just a way to say **“thank you”** — donations won’t provide priority
> support or special privileges.
## :trophy: Gold Sponsorship
Companies donating **$50/month or more** can become a **Gold Sponsor**, featured
on:
- The website homepage
- The GitHub repository README
> 💬 To be featured, contact @andreynering with your logo.
>
> ⚠️ Suspicious or inappropriate businesses (e.g. gambling, casinos) will be
> rejected.
## :heart: GitHub Sponsors _(recommended)_
The preferred way to donate is through **GitHub Sponsors**. We suggest splitting
your donation equally between maintainers:
<div style="display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0;">
<a href="https://github.com/sponsors/andreynering" target="_blank">
<img src="https://img.shields.io/badge/@andreynering-30363d?logo=github&logoColor=white&style=for-the-badge" />
</a>
<a href="https://github.com/sponsors/pd93" target="_blank">
<img src="https://img.shields.io/badge/@pd93-30363d?logo=github&logoColor=white&style=for-the-badge" />
</a>
<a href="https://github.com/sponsors/vmaerten" target="_blank">
<img src="https://img.shields.io/badge/@vmaerten-30363d?logo=github&logoColor=white&style=for-the-badge" />
</a>
</div>
## :globe_with_meridians: Open Collective
Prefer **Open Collective**? Choose a tier:
- [$2/month](https://opencollective.com/task/contribute/backer-4034/checkout)
- [$5/month](https://opencollective.com/task/contribute/supporter-8404/checkout)
- [$20/month](https://opencollective.com/task/contribute/sponsor-4035/checkout)
- [$50/month](https://opencollective.com/task/contribute/sponsor-28775/checkout)
- [🎯 Custom / One-time](https://opencollective.com/task/donate)
## :credit_card: PayPal
You can also make a **one-time donation** to @andreynering via PayPal:
[Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A&currency_code=USD&source=url)
## :brazil: PIX (Brazil only)
If you're in Brazil, you can also support @andreynering via PIX:
<img src="/img/pix.png" width="200" height="200" alt="PIX QR Code" />
Thank you for helping Taskfile grow and stay maintained! 💚

48
website/src/index.md Normal file
View File

@@ -0,0 +1,48 @@
---
layout: home
hero:
name: Task
text: The Modern Task Runner
tagline:
A fast, cross-platform build tool inspired by Make, designed for modern
workflows.
image:
src: /img/logo.png
alt: Task logo
actions:
- theme: brand
text: Install
link: /docs/installation
- theme: alt
text: Get Started
link: /docs/getting-started
- theme: alt
text: Guide
link: /docs/guide
features:
- title: 30-Second Setup
details:
Single binary download, zero dependencies. Works with Homebrew, Snapcraft,
Scoop and more.
icon: 🚀
- title: Truly cross-platform
icon: 🖥️
details:
Run the same Taskfile on Linux, macOS and Windows. No extra setup. Task
handles platform quirks so you don’t have to.
- title: Smart Caching
icon: 🎯
details:
Skip unnecessary rebuilds by tracking file changes (timestamp or
content-based).
- title: Ideal for code generation & scaffolding
icon: ⚡
details:
Use Task to wire up codegen tools, formatters, linters, or anything
repetitive. Chain commands, set dependencies, and keep your workflow
clean.
---

View File

@@ -1,53 +0,0 @@
---
slug: /donate/
hide_table_of_contents: true
---
# Donate
If you find this project useful, you can consider donating by using one of the
channels listed below.
This is just a way of saying "thank you", it won't give you any benefits like
higher priority on issues or something similar.
Companies who donate at least $50/month will be featured as a "Gold Sponsor" in
the website homepage and on the GitHub repository README. Make contact with
[@andreynering] with the logo you want to be shown. Suspect businesses
(gambling, casinos, etc) won't be allowed, though.
## GitHub Sponsors
The preferred way to donate to the maintainers is via GitHub Sponsors. Just use
the following links to do your donation. We suggest a equal weight split to each
maintainer of the total amount you plan to donate to the project.
- [@andreynering](https://github.com/sponsors/andreynering)
- [@pd93](https://github.com/sponsors/pd93)
- [@vmaerten](https://github.com/sponsors/vmaerten)
## Open Collective
If you prefer [Open Collective](https://opencollective.com/task) you can donate
by using these links:
- [$2 per month](https://opencollective.com/task/contribute/backer-4034/checkout)
- [$5 per month](https://opencollective.com/task/contribute/supporter-8404/checkout)
- [$20 per month](https://opencollective.com/task/contribute/sponsor-4035/checkout)
- [$50 per month](https://opencollective.com/task/contribute/sponsor-28775/checkout)
- [Custom value - One-time donation option supported](https://opencollective.com/task/donate)
## PayPal
You can donate to [@andreynering] via PayPal as well:
- [Any value - One-time donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A&currency_code=USD&source=url)
## PIX (Brazil only)
And if you're Brazilian, you can also donate to [@andreynering] via PIX by
[using this QR Code](/img/pix.png).
<!-- prettier-ignore-start -->
[@andreynering]: https://github.com/andreynering
<!-- prettier-ignore-end -->

View File

@@ -0,0 +1,20 @@
# Redirect specific docs pages
/changelog /docs/changelog
/community /docs/community
/contributing /docs/contributing
/faq /docs/faq
/getting-started /docs/getting-started
/installation /docs/installation
/integrations /docs/integrations
/releasing /docs/releasing
/styleguide /docs/styleguide
/taskfile-versions /docs/taskfile-versions
/usage /docs/guide
# Redirect some group docs pages
/deprecations/* /docs/deprecations/:splat
/experiments/* /docs/experiments:splat
/reference/* /docs/reference/:splat
# Redirect root /docs to something useful
/docs /docs/guide

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#009B3A" d="M36 27a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4h28a4 4 0 0 1 4 4z"/><path fill="#FEDF01" d="M32.728 18 18 29.124 3.272 18 18 6.875z"/><circle cx="17.976" cy="17.924" r="6.458" fill="#002776"/><path fill="#CBE9D4" d="M12.277 14.887a6.4 6.4 0 0 0-.672 2.023c3.995-.29 9.417 1.891 11.744 4.595.402-.604.7-1.28.883-2.004-2.872-2.808-7.917-4.63-11.955-4.614"/><path fill="#88C9F9" d="M12 18.233h1v1h-1zm1 2h1v1h-1z"/><path fill="#55ACEE" d="M15 18.233h1v1h-1zm2 1h1v1h-1zm4 2h1v1h-1zm-3 1h1v1h-1zm3-6h1v1h-1z"/><path fill="#3B88C3" d="M19 20.233h1v1h-1z"/></svg>

After

Width:  |  Height:  |  Size: 646 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#ED2939" d="M36 27a4 4 0 0 1-4 4h-8V5h8a4 4 0 0 1 4 4z"/><path fill="#002495" d="M4 5a4 4 0 0 0-4 4v18a4 4 0 0 0 4 4h8V5z"/><path fill="#EEE" d="M12 5h12v26H12z"/></svg>

After

Width:  |  Height:  |  Size: 241 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 435 B

View File

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show More