1
1
Fork 0
mirror of https://gitea.com/gitea/tea synced 2024-04-25 19:35:20 +02:00

Handle XDG directories with spaces in autocomplete commands (#383)

On some OSs ([i.e. macOS](https://github.com/adrg/xdg#xdg-base-directory)), XDG directories contain spaces, so we need to wrap the resulting path used in autocomplete sourcing commands in quotation marks.

Co-authored-by: Matthew Daley <mattd@bugfuzz.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/383
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Co-authored-by: nukuta <nukuta@noreply.gitea.io>
Co-committed-by: nukuta <nukuta@noreply.gitea.io>
This commit is contained in:
nukuta 2021-07-24 00:14:23 +08:00 committed by Andrew Thornton
parent 0f4f669cf0
commit 546fcc16de

View File

@ -40,12 +40,12 @@ func runAutocompleteAdd(ctx *cli.Context) error {
case "zsh":
remoteFile = "contrib/autocomplete.zsh"
localFile = "autocomplete.zsh"
cmds = "echo 'PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source %s' >> ~/.zshrc && source ~/.zshrc"
cmds = "echo 'PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source \"%s\"' >> ~/.zshrc && source ~/.zshrc"
case "bash":
remoteFile = "contrib/autocomplete.sh"
localFile = "autocomplete.sh"
cmds = "echo 'PROG=tea source %s' >> ~/.bashrc && source ~/.bashrc"
cmds = "echo 'PROG=tea source \"%s\"' >> ~/.bashrc && source ~/.bashrc"
case "powershell":
remoteFile = "contrib/autocomplete.ps1"