diff --git a/docs/installation.md b/docs/installation.md index e421d86..647015c 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,6 +1,16 @@ # Installing ty -## Adding ty to your project +## Running ty without installation + +Use [uvx](https://docs.astral.sh/uv/guides/tools/) to quickly get started with ty: + +```shell +uvx ty +``` + +## Installation methods + +### Adding ty to your project !!! tip @@ -20,7 +30,13 @@ Then, use `uv run` to invoke ty: uv run ty ``` -## Installing globally +To update ty, use `--upgrade-package`: + +```shell +uv lock --upgrade-package ty +``` + +### Installing globally with uv Install ty globally with uv: @@ -28,13 +44,27 @@ Install ty globally with uv: uv tool install ty@latest ``` -Or, pipx: +To update ty, use `uv tool upgrade`: + +```shell +uv tool upgrade ty +``` + +### Installing globally with pipx + +Install ty globally with pipx: ```shell pipx install ty ``` -## Installing with pip +To update ty, use `pipx upgrade`: + +```shell +pipx upgrade ty +``` + +### Installing with pip Install ty into your current Python environment with pip: @@ -45,3 +75,46 @@ pip install ty ## Adding ty to your editor See the [editor integration](./editors.md) guide to add ty to your editor. + +## Shell autocompletion + +!!! tip + + You can run `echo $SHELL` to help you determine your shell. + +To enable shell autocompletion for ty commands, run one of the following: + +=== "Bash" + + ```bash + echo 'eval "$(ty generate-shell-completion bash)"' >> ~/.bashrc + ``` + +=== "Zsh" + + ```bash + echo 'eval "$(ty generate-shell-completion zsh)"' >> ~/.zshrc + ``` + +=== "fish" + + ```bash + echo 'ty generate-shell-completion fish | source' > ~/.config/fish/completions/ty.fish + ``` + +=== "Elvish" + + ```bash + echo 'eval (ty generate-shell-completion elvish | slurp)' >> ~/.elvish/rc.elv + ``` + +=== "PowerShell / pwsh" + + ```powershell + if (!(Test-Path -Path $PROFILE)) { + New-Item -ItemType File -Path $PROFILE -Force + } + Add-Content -Path $PROFILE -Value '(& ty generate-shell-completion powershell) | Out-String | Invoke-Expression' + ``` + +Then restart the shell or source the shell config file.