As a V2 improvement, I would love if we could move the script definition here back into core azd completions. If we did this, we would keep the postProcess around because that is still useful:
It may be worth creating an issue to move these completions into core azd, and avoid the ownership here in figspec.
The most native way is when to pull out the flag completion funcs defined in cobra as below:
cmd.RegisterFlagCompletionFunc("mode", func(
cmd *cobra.Command, args []string, toComplete string,
) ([]string, cobra.ShellCompDirective) {
return []string{"dev", "staging", "prod"}, cobra.ShellCompDirectiveNoFileComp
})
Originally posted by @weikanglim in #5955 (comment) and #5955 (comment)