mirror of
https://github.com/go-task/task.git
synced 2025-04-15 11:56:34 +02:00
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[217],{3905:function(e,t,a){a.d(t,{Zo:function(){return u},kt:function(){return h}});var n=a(7294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function r(e,t){if(null==e)return{};var a,n,l=function(e,t){if(null==e)return{};var a,n,l={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),c=p(a),m=l,h=c["".concat(s,".").concat(m)]||c[m]||k[m]||o;return a?n.createElement(h,i(i({ref:t},u),{},{components:a})):n.createElement(h,i({ref:t},u))}));function h(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=a.length,i=new Array(o);i[0]=m;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:l,i[1]=r;for(var p=2;p<o;p++)i[p]=a[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},9803:function(e,t,a){a.r(t),a.d(t,{assets:function(){return s},contentTitle:function(){return i},default:function(){return c},frontMatter:function(){return o},metadata:function(){return r},toc:function(){return p}});var n=a(3117),l=(a(7294),a(3905));const o={slug:"/installation/",sidebar_position:2},i="Installation",r={unversionedId:"installation",id:"installation",title:"Installation",description:"Task offers many installation methods. Check out the available methods below.",source:"@site/docs/installation.md",sourceDirName:".",slug:"/installation/",permalink:"/installation/",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{slug:"/installation/",sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Home",permalink:"/"},next:{title:"Usage",permalink:"/usage/"}},s={},p=[{value:"Package Managers",id:"package-managers",level:2},{value:"Homebrew",id:"homebrew",level:3},{value:"Snap",id:"snap",level:3},{value:"Chocolatey",id:"chocolatey",level:3},{value:"Scoop",id:"scoop",level:3},{value:"AUR",id:"aur",level:3},{value:"Fedora",id:"fedora",level:3},{value:"Nix",id:"nix",level:3},{value:"npm",id:"npm",level:3},{value:"Winget",id:"winget",level:3},{value:"Get The Binary",id:"get-the-binary",level:2},{value:"Binary",id:"binary",level:3},{value:"Install Script",id:"install-script",level:3},{value:"GitHub Actions",id:"github-actions",level:3},{value:"Build From Source",id:"build-from-source",level:2},{value:"Go Modules",id:"go-modules",level:3},{value:"Setup completions",id:"setup-completions",level:2},{value:"Bash",id:"bash",level:3},{value:"ZSH",id:"zsh",level:3},{value:"Fish",id:"fish",level:3},{value:"PowerShell",id:"powershell",level:3}],u={toc:p};function c(e){let{components:t,...a}=e;return(0,l.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"installation"},"Installation"),(0,l.kt)("p",null,"Task offers many installation methods. Check out the available methods below."),(0,l.kt)("h2",{id:"package-managers"},"Package Managers"),(0,l.kt)("h3",{id:"homebrew"},"Homebrew"),(0,l.kt)("p",null,"If you're on macOS or Linux and have ",(0,l.kt)("a",{parentName:"p",href:"https://brew.sh/"},"Homebrew")," installed, getting\nTask is as simple as running:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"brew install go-task/tap/go-task\n")),(0,l.kt)("p",null,"The above Formula is\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb"},"maintained by ourselves"),"."),(0,l.kt)("p",null,"Recently, Task was also made available\n",(0,l.kt)("a",{parentName:"p",href:"https://formulae.brew.sh/formula/go-task"},"on the official Homebrew repository"),",\nso you also have that option if you prefer:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"brew install go-task\n")),(0,l.kt)("h3",{id:"snap"},"Snap"),(0,l.kt)("p",null,"Task is available in ",(0,l.kt)("a",{parentName:"p",href:"https://snapcraft.io/task"},"Snapcraft"),", but keep in mind that your Linux\ndistribution should allow classic confinement for Snaps to Task work right:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"sudo snap install task --classic\n")),(0,l.kt)("h3",{id:"chocolatey"},"Chocolatey"),(0,l.kt)("p",null,"If you're on Windows and have ",(0,l.kt)("a",{parentName:"p",href:"https://chocolatey.org/"},"Chocolatey")," installed, getting Task is as\nsimple as running:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"choco install go-task\n")),(0,l.kt)("p",null,"This installation method is community owned."),(0,l.kt)("h3",{id:"scoop"},"Scoop"),(0,l.kt)("p",null,"If you're on Windows and have ",(0,l.kt)("a",{parentName:"p",href:"https://scoop.sh/"},"Scoop")," installed, getting Task is as\nsimple as running:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-cmd"},"scoop install task\n")),(0,l.kt)("p",null,"This installation method is community owned. After a new release of Task, it may\ntake some time until it's available on Scoop."),(0,l.kt)("h3",{id:"aur"},"AUR"),(0,l.kt)("p",null,"If you're on Arch Linux you can install Task from\n",(0,l.kt)("a",{parentName:"p",href:"https://aur.archlinux.org/packages/go-task-bin"},"AUR")," using your favorite\npackage manager such as ",(0,l.kt)("inlineCode",{parentName:"p"},"yay"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"pacaur")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"yaourt"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-cmd"},"yay -S go-task-bin\n")),(0,l.kt)("p",null,"Alternatively, there's\n",(0,l.kt)("a",{parentName:"p",href:"https://aur.archlinux.org/packages/go-task"},"this package")," which installs from\nthe source code instead of downloading the binary from the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/releases"},"releases page"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-cmd"},"yay -S go-task\n")),(0,l.kt)("p",null,"This installation method is community owned."),(0,l.kt)("h3",{id:"fedora"},"Fedora"),(0,l.kt)("p",null,"If you're on Fedora Linux you can install Task from the official\n",(0,l.kt)("a",{parentName:"p",href:"https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/"},"Fedora"),"\nrepository using ",(0,l.kt)("inlineCode",{parentName:"p"},"dnf"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-cmd"},"sudo dnf install go-task\n")),(0,l.kt)("p",null,"This installation method is community owned. After a new release of Task, it may\ntake some time until it's available in\n",(0,l.kt)("a",{parentName:"p",href:"https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/"},"Fedora"),"."),(0,l.kt)("h3",{id:"nix"},"Nix"),(0,l.kt)("p",null,"If you're on NixOS or have Nix installed you can install Task from\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/NixOS/nixpkgs"},"nixpkgs"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-cmd"},"nix-env -iA nixpkgs.go-task\n")),(0,l.kt)("p",null,"This installation method is community owned. After a new release of Task, it may\ntake some time until it's available in\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/NixOS/nixpkgs"},"nixpkgs"),"."),(0,l.kt)("h3",{id:"npm"},"npm"),(0,l.kt)("p",null,"You can also use Node and npm to install Task by installing\n",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/@go-task/cli"},"this package"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g @go-task/cli\n")),(0,l.kt)("h3",{id:"winget"},"Winget"),(0,l.kt)("p",null,"If you are using Windows and installed the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/microsoft/winget-cli"},"winget")," package management tool, you\ncan install Task from ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/microsoft/winget-pkgs"},"winget-pkgs"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"winget install Task.Task\n")),(0,l.kt)("h2",{id:"get-the-binary"},"Get The Binary"),(0,l.kt)("h3",{id:"binary"},"Binary"),(0,l.kt)("p",null,"You can download the binary from the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/releases"},"releases page on GitHub")," and add\nto your ",(0,l.kt)("inlineCode",{parentName:"p"},"$PATH"),"."),(0,l.kt)("p",null,"DEB and RPM packages are also available."),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"task_checksums.txt")," file contains the SHA-256 checksum for each file."),(0,l.kt)("h3",{id:"install-script"},"Install Script"),(0,l.kt)("p",null,"We also have an ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/blob/master/install-task.sh"},"install script")," which is very useful in\nscenarios like CI. Many thanks to ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/goreleaser/godownloader"},"GoDownloader")," for enabling the\neasy generation of this script."),(0,l.kt)("p",null,"By default, it installs on the ",(0,l.kt)("inlineCode",{parentName:"p"},"./bin")," directory relative to the working\ndirectory:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d\n')),(0,l.kt)("p",null,"It is possible to override the installation directory with the ",(0,l.kt)("inlineCode",{parentName:"p"},"-b")," parameter.\nOn Linux, common choices are ",(0,l.kt)("inlineCode",{parentName:"p"},"~/.local/bin")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"~/bin")," to install for the\ncurrent user or ",(0,l.kt)("inlineCode",{parentName:"p"},"/usr/local/bin")," to install for all users:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin\n')),(0,l.kt)("admonition",{type:"caution"},(0,l.kt)("p",{parentName:"admonition"},"On macOS and Windows, ",(0,l.kt)("inlineCode",{parentName:"p"},"~/.local/bin")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"~/bin")," are not added to ",(0,l.kt)("inlineCode",{parentName:"p"},"$PATH")," by\ndefault.")),(0,l.kt)("h3",{id:"github-actions"},"GitHub Actions"),(0,l.kt)("p",null,"If you want to install Task in GitHub Actions you can try using\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/arduino/setup-task"},"this action")," by the Arduino team:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-yaml"},"- name: Install Task\n uses: arduino/setup-task@v1\n with:\n version: 3.x\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n")),(0,l.kt)("p",null,"This installation method is community owned."),(0,l.kt)("h2",{id:"build-from-source"},"Build From Source"),(0,l.kt)("h3",{id:"go-modules"},"Go Modules"),(0,l.kt)("p",null,"Ensure that you have a supported version of ",(0,l.kt)("a",{parentName:"p",href:"https://golang.org/"},"Go")," properly installed and\nsetup. You can find the minimum required version of Go in the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/blob/master/go.mod#L3"},"go.mod")," file."),(0,l.kt)("p",null,"You can then install the latest release globally by running:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"go install github.com/go-task/task/v3/cmd/task@latest\n")),(0,l.kt)("p",null,"Or you can install into another directory:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest\n")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"For CI environments we recommend using the ",(0,l.kt)("a",{parentName:"p",href:"#install-script"},"install script"),"\ninstead, which is faster and more stable, since it'll just download the latest\nreleased binary.")),(0,l.kt)("h2",{id:"setup-completions"},"Setup completions"),(0,l.kt)("p",null,"Download the autocompletion file corresponding to your shell."),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/tree/master/completion"},"All completions are available on the Task repository"),"."),(0,l.kt)("h3",{id:"bash"},"Bash"),(0,l.kt)("p",null,"First, ensure that you installed bash-completion using your package manager."),(0,l.kt)("p",null,"Make the completion file executable:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"chmod +x path/to/task.bash\n")),(0,l.kt)("p",null,"After, add this to your ",(0,l.kt)("inlineCode",{parentName:"p"},"~/.bash_profile"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-shell"},"source path/to/task.bash\n")),(0,l.kt)("h3",{id:"zsh"},"ZSH"),(0,l.kt)("p",null,"Put the ",(0,l.kt)("inlineCode",{parentName:"p"},"_task")," file somewhere in your ",(0,l.kt)("inlineCode",{parentName:"p"},"$FPATH"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-shell"},"mv path/to/_task /usr/local/share/zsh/site-functions/_task\n")),(0,l.kt)("p",null,"Ensure that the following is present in your ",(0,l.kt)("inlineCode",{parentName:"p"},"~/.zshrc"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-shell"},"autoload -U compinit\ncompinit -i\n")),(0,l.kt)("p",null,"ZSH version 5.7 or later is recommended."),(0,l.kt)("h3",{id:"fish"},"Fish"),(0,l.kt)("p",null,"Move the ",(0,l.kt)("inlineCode",{parentName:"p"},"task.fish")," completion script:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-shell"},"mv path/to/task.fish ~/.config/fish/completions/task.fish\n")),(0,l.kt)("h3",{id:"powershell"},"PowerShell"),(0,l.kt)("p",null,"Open your profile script with:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue\nnotepad $profile\n")),(0,l.kt)("p",null,"Add the line and save the file:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-shell"},"Invoke-Expression -Command path/to/task.ps1\n")))}c.isMDXComponent=!0}}]); |