mirror of
https://github.com/go-task/task.git
synced 2025-03-21 21:27:07 +02:00
1 line
16 KiB
JavaScript
1 line
16 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 k}});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 i(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 o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(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={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[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):o(o({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={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,i=e.originalType,s=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),m=p(a),k=l,d=m["".concat(s,".").concat(k)]||m[k]||c[k]||i;return a?n.createElement(d,o(o({ref:t},u),{},{components:a})):n.createElement(d,o({ref:t},u))}));function k(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var i=a.length,o=new Array(i);o[0]=m;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r.mdxType="string"==typeof e?e:l,o[1]=r;for(var p=2;p<i;p++)o[p]=a[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"},9250:function(e,t,a){a.r(t),a.d(t,{assets:function(){return u},contentTitle:function(){return s},default:function(){return k},frontMatter:function(){return r},metadata:function(){return p},toc:function(){return c}});var n=a(7462),l=a(3366),i=(a(7294),a(3905)),o=["components"],r={slug:"/installation/",sidebar_position:2},s="Installation",p={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/"}},u={},c=[{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:"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}],m={toc:c};function k(e){var t=e.components,a=(0,l.Z)(e,o);return(0,i.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"installation"},"Installation"),(0,i.kt)("p",null,"Task offers many installation methods. Check out the available methods below."),(0,i.kt)("h2",{id:"package-managers"},"Package Managers"),(0,i.kt)("h3",{id:"homebrew"},"Homebrew"),(0,i.kt)("p",null,"If you're on macOS or Linux and have ",(0,i.kt)("a",{parentName:"p",href:"https://brew.sh/"},"Homebrew")," installed, getting\nTask is as simple as running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"brew install go-task/tap/go-task\n")),(0,i.kt)("h3",{id:"snap"},"Snap"),(0,i.kt)("p",null,"Task is available in ",(0,i.kt)("a",{parentName:"p",href:"https://snapcraft.io/task"},"Snapcraft"),", but keep in mind that your\nLinux distribution should allow classic confinement for Snaps to Task work\nright:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"sudo snap install task --classic\n")),(0,i.kt)("h3",{id:"chocolatey"},"Chocolatey"),(0,i.kt)("p",null,"If you're on Windows and have ",(0,i.kt)("a",{parentName:"p",href:"https://chocolatey.org/"},"Chocolatey")," installed, getting\nTask is as simple as running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"choco install go-task\n")),(0,i.kt)("p",null,"This installation method is community owned."),(0,i.kt)("h3",{id:"scoop"},"Scoop"),(0,i.kt)("p",null,"If you're on Windows and have ",(0,i.kt)("a",{parentName:"p",href:"https://scoop.sh/"},"Scoop")," installed, getting\nTask is as simple as running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cmd"},"scoop install task\n")),(0,i.kt)("p",null,"This installation method is community owned. After a new release of Task, it\nmay take some time until it's available on Scoop."),(0,i.kt)("h3",{id:"aur"},"AUR"),(0,i.kt)("p",null,"If you're on Arch Linux you can install Task from\n",(0,i.kt)("a",{parentName:"p",href:"https://aur.archlinux.org/packages/go-task-bin"},"AUR")," using your favorite\npackage manager such as ",(0,i.kt)("inlineCode",{parentName:"p"},"yay"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"pacaur")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"yaourt"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cmd"},"yay -S go-task-bin\n")),(0,i.kt)("p",null,"Alternatively, there's\n",(0,i.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,i.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/releases"},"releases page"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cmd"},"yay -S go-task\n")),(0,i.kt)("p",null,"This installation method is community owned."),(0,i.kt)("h3",{id:"fedora"},"Fedora"),(0,i.kt)("p",null,"If you're on Fedora Linux you can install Task from the official\n",(0,i.kt)("a",{parentName:"p",href:"https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/"},"Fedora")," repository using ",(0,i.kt)("inlineCode",{parentName:"p"},"dnf"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cmd"},"sudo dnf install go-task\n")),(0,i.kt)("p",null,"This installation method is community owned. After a new release of Task, it\nmay take some time until it's available in ",(0,i.kt)("a",{parentName:"p",href:"https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/"},"Fedora"),"."),(0,i.kt)("h3",{id:"nix"},"Nix"),(0,i.kt)("p",null,"If you're on NixOS or have Nix installed\nyou can install Task from ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/NixOS/nixpkgs"},"nixpkgs"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cmd"},"nix-env -iA nixpkgs.go-task\n")),(0,i.kt)("p",null,"This installation method is community owned. After a new release of Task, it\nmay take some time until it's available in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/NixOS/nixpkgs"},"nixpkgs"),"."),(0,i.kt)("h3",{id:"npm"},"npm"),(0,i.kt)("p",null,"You can also use Node and npm to install Task by installing\n",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/@go-task/cli"},"this package"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g @go-task/cli\n")),(0,i.kt)("h2",{id:"get-the-binary"},"Get The Binary"),(0,i.kt)("h3",{id:"binary"},"Binary"),(0,i.kt)("p",null,"You can download the binary from the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/releases"},"releases page on GitHub")," and\nadd to your ",(0,i.kt)("inlineCode",{parentName:"p"},"$PATH"),"."),(0,i.kt)("p",null,"DEB and RPM packages are also available."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"task_checksums.txt")," file contains the SHA-256 checksum for each file."),(0,i.kt)("h3",{id:"install-script"},"Install Script"),(0,i.kt)("p",null,"We also have an ",(0,i.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,i.kt)("a",{parentName:"p",href:"https://github.com/goreleaser/godownloader"},"GoDownloader")," for enabling the\neasy generation of this script."),(0,i.kt)("p",null,"By default, it installs on the ",(0,i.kt)("inlineCode",{parentName:"p"},"./bin")," directory relative to the working\ndirectory:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d\n')),(0,i.kt)("p",null,"It is possible to override the installation directory with the ",(0,i.kt)("inlineCode",{parentName:"p"},"-b")," parameter.\nOn Linux, common choices are ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.local/bin")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"~/bin")," to install for the\ncurrent user or ",(0,i.kt)("inlineCode",{parentName:"p"},"/usr/local/bin")," to install for all users:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin\n')),(0,i.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"On macOS and Windows, ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.local/bin")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"~/bin")," are not added to ",(0,i.kt)("inlineCode",{parentName:"p"},"$PATH")," by\ndefault."))),(0,i.kt)("h3",{id:"github-actions"},"GitHub Actions"),(0,i.kt)("p",null,"If you want to install Task in GitHub Actions you can try using\n",(0,i.kt)("a",{parentName:"p",href:"https://github.com/arduino/setup-task"},"this action"),"\nby the Arduino team:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"- name: Install Task\n uses: arduino/setup-task@v1\n")),(0,i.kt)("p",null,"This installation method is community owned."),(0,i.kt)("h2",{id:"build-from-source"},"Build From Source"),(0,i.kt)("h3",{id:"go-modules"},"Go Modules"),(0,i.kt)("p",null,"First, make sure you have ",(0,i.kt)("a",{parentName:"p",href:"https://golang.org/"},"Go")," properly installed and setup."),(0,i.kt)("p",null,"You can easily install the latest release globally by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"go install github.com/go-task/task/v3/cmd/task@latest\n")),(0,i.kt)("p",null,"Or you can install into another directory:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest\n")),(0,i.kt)("p",null,"If using Go 1.15 or earlier, instead use:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"env GO111MODULE=on go get -u github.com/go-task/task/v3/cmd/task@latest\n")),(0,i.kt)("div",{className:"admonition admonition-tip alert alert--success"},(0,i.kt)("div",{parentName:"div",className:"admonition-heading"},(0,i.kt)("h5",{parentName:"div"},(0,i.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,i.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,i.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"tip")),(0,i.kt)("div",{parentName:"div",className:"admonition-content"},(0,i.kt)("p",{parentName:"div"},"For CI environments we recommend using the ",(0,i.kt)("a",{parentName:"p",href:"#get-the-binary"},"install script"),"\ninstead, which is faster and more stable, since it'll just download the latest\nreleased binary."))),(0,i.kt)("h2",{id:"setup-completions"},"Setup completions"),(0,i.kt)("p",null,"Download the autocompletion file corresponding to your shell."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/tree/master/completion"},"All completions are available on the Task repository"),"."),(0,i.kt)("h3",{id:"bash"},"Bash"),(0,i.kt)("p",null,"First, ensure that you installed bash-completion using your package manager."),(0,i.kt)("p",null,"Make the completion file executable:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"chmod +x path/to/task.bash\n")),(0,i.kt)("p",null,"After, add this to your ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.bash_profile"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"source path/to/task.bash\n")),(0,i.kt)("h3",{id:"zsh"},"ZSH"),(0,i.kt)("p",null,"Put the ",(0,i.kt)("inlineCode",{parentName:"p"},"_task")," file somewhere in your ",(0,i.kt)("inlineCode",{parentName:"p"},"$FPATH"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"mv path/to/_task /usr/local/share/zsh/site-functions/_task\n")),(0,i.kt)("p",null,"Ensure that the following is present in your ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.zshrc"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"autoload -U compinit\ncompinit -i\n")),(0,i.kt)("p",null,"ZSH version 5.7 or later is recommended."),(0,i.kt)("h3",{id:"fish"},"Fish"),(0,i.kt)("p",null,"Move the ",(0,i.kt)("inlineCode",{parentName:"p"},"task.fish")," completion script:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"mv path/to/task.fish ~/.config/fish/completions/task.fish\n")),(0,i.kt)("h3",{id:"powershell"},"PowerShell"),(0,i.kt)("p",null,"Open your profile script with:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue\nnotepad $profile\n")),(0,i.kt)("p",null,"Add the line and save the file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"Invoke-Expression -Command path/to/task.ps1\n")))}k.isMDXComponent=!0}}]); |