1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

cmd: make auto completion work for all shells and reduce the size

This updates the bash completion to work with GenBashCompletionV2
which cuts down the size of the completion file dramatically.

See: https://forum.rclone.org/t/request-make-remote-path-completion-work-for-fish-and-zsh/42982/
See: #7000
This commit is contained in:
Nick Craig-Wood
2023-11-23 10:12:37 +00:00
parent 186bb85c44
commit 15890b7ce7
3 changed files with 191 additions and 52 deletions

View File

@@ -38,7 +38,7 @@ If output_file is "-", then the output will be written to stdout.
out := "/etc/bash_completion.d/rclone"
if len(args) > 0 {
if args[0] == "-" {
err := cmd.Root.GenBashCompletion(os.Stdout)
err := cmd.Root.GenBashCompletionV2(os.Stdout, false)
if err != nil {
log.Fatal(err)
}
@@ -46,7 +46,7 @@ If output_file is "-", then the output will be written to stdout.
}
out = args[0]
}
err := cmd.Root.GenBashCompletionFile(out)
err := cmd.Root.GenBashCompletionFileV2(out, false)
if err != nil {
log.Fatal(err)
}