Had a similar issue with an in house tool and learned that `click`, the framework we use for CLI's, has built in support for generating auto completions[0].
Could be worth it for others to check if such a feature exists for the framework they're using.