You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to write custom completions for skopeo, and I ran into something that I don't know if it's possible to do using the builtin cobra completions.
I'm trying to make this complete directories:
skopeo copy dir:<TAB>
I tried returning nil, cobra.ShellCompDirectiveFilterDirs | cobra.ShellCompDirectiveNoFileComp, but this doesn't complete anything. It seems to be because _filedir -d looks at $cur when completing (when it eventually calls compgen here), and since cur is dir: it doesn't find any completions. I manually edited the completion file and it did manage to complete directories like I wanted:
cur=${cur#"dir:"}
_filedir -d
Is there some way to solve this issue with cobra?
The PR I created for skopeo: containers/skopeo#2524
I only tested this with bash
Bash version: 5.1.16(1)-release
The text was updated successfully, but these errors were encountered:
Hello, I'm trying to write custom completions for skopeo, and I ran into something that I don't know if it's possible to do using the builtin cobra completions.
I'm trying to make this complete directories:
I tried returning
nil, cobra.ShellCompDirectiveFilterDirs | cobra.ShellCompDirectiveNoFileComp
, but this doesn't complete anything. It seems to be because_filedir -d
looks at$cur
when completing (when it eventually calls compgen here), and since cur isdir:
it doesn't find any completions. I manually edited the completion file and it did manage to complete directories like I wanted:Is there some way to solve this issue with cobra?
The PR I created for skopeo: containers/skopeo#2524
I only tested this with bash
Bash version:
5.1.16(1)-release
The text was updated successfully, but these errors were encountered: