cobra icon indicating copy to clipboard operation
cobra copied to clipboard

Completion and sudo

Open apostasie opened this issue 6 months ago • 7 comments

Hi,

For nerdctl, we are interested in displaying different completion if called with sudo vs. called directly. (https://github.com/containerd/nerdctl/issues/99 ).

Do you have a recommendation on how to implement this / approach this problem?

I assume we would have to patch: https://github.com/spf13/cobra/blob/v1.8.1/bash_completionsV2.go#L84 to call with sudo if needed.

But then, how do we decide that? Use _complete_as_root to test?

Thanks a lot.

apostasie avatar Aug 18 '24 16:08 apostasie