spf13/cobra

Huge bash completions file that's very slow to source

memeplex opened this issue · 2 comments

I'm opening this issue because of repeated reports about rclone's bash completions file being too big and slow to load:

A simple python script that heuristically detects large duplicated chunks was able to reduce the size of the script from 130000 lines to 5000 lines, so clearly there is room for improvement.

In rclone/rclone#7000 it was stated that:

We use the bash completion auto generator from the cobra package:
https://github.com/spf13/cobra/blob/main/shell_completions.md
If someone wants to fix this, it needs to be fixed in https://github.com/spf13/cobra/

@memeplex You should use GenBashCompletionV2() instead of the legacy GenBashCompletion()

I’m going to close this as there is a solution