mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
completion should suggest directories if use contains DIR
This commit is contained in:
@@ -52,6 +52,10 @@ func Complete(cmd *cobra.Command) *complete.Command {
|
|||||||
Flags: map[string]complete.Predictor{},
|
Flags: map[string]complete.Predictor{},
|
||||||
Sub: map[string]*complete.Command{},
|
Sub: map[string]*complete.Command{},
|
||||||
}
|
}
|
||||||
|
if strings.Contains(cmd.Use, "DIR") {
|
||||||
|
// if usage contains directory, then use a file predictor
|
||||||
|
cc.Args = predict.Dirs("*")
|
||||||
|
}
|
||||||
|
|
||||||
// add completion for each subcommand
|
// add completion for each subcommand
|
||||||
for i := range cmd.Commands() {
|
for i := range cmd.Commands() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
func GetFmtRunner(name string) *FmtRunner {
|
func GetFmtRunner(name string) *FmtRunner {
|
||||||
r := &FmtRunner{}
|
r := &FmtRunner{}
|
||||||
c := &cobra.Command{
|
c := &cobra.Command{
|
||||||
Use: "fmt",
|
Use: "fmt DIR...",
|
||||||
Short: commands.FmtShort,
|
Short: commands.FmtShort,
|
||||||
Long: commands.FmtLong,
|
Long: commands.FmtLong,
|
||||||
Example: commands.FmtExamples,
|
Example: commands.FmtExamples,
|
||||||
|
|||||||
Reference in New Issue
Block a user