MCPcopy Create free account
hub / github.com/carvel-dev/kapp-controller / getIncludedPaths

Method getIncludedPaths

cli/pkg/kctrl/local/sources/git.go:98–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96}
97
98func (g *GitSource) getIncludedPaths() error {
99 contents := g.vendirConfig.Contents()
100 g.ui.PrintInformationalText("We need to know which files contain Kubernetes manifests. Multiple files can be included using a comma separator.\n" +
101 "- To include all the files, enter *\n" +
102 "- To include a folder with all the sub-folders and files, enter <FOLDER_NAME>/**/* \n" +
103 "- To include all the files inside a folder, enter <FOLDER_NAME>/*")
104 includedPaths := contents[0].IncludePaths
105 defaultIncludedPath := strings.Join(includedPaths, ",")
106 if len(includedPaths) == 0 {
107 defaultIncludedPath = includeAllFiles
108 }
109 textOpts := ui.TextOpts{
110 Label: "Enter the paths which contain Kubernetes manifests",
111 Default: defaultIncludedPath,
112 ValidateFunc: nil,
113 }
114 path, err := g.ui.AskForText(textOpts)
115 if err != nil {
116 return err
117 }
118 paths := strings.Split(path, ",")
119 if path == includeAllFiles {
120 paths = nil
121 }
122 for i := 0; i < len(paths); i++ {
123 paths[i] = strings.TrimSpace(paths[i])
124 }
125 contents[0].IncludePaths = paths
126 g.vendirConfig.SetContents(contents)
127 return g.vendirConfig.Save()
128}

Callers 1

ConfigureMethod · 0.95

Calls 5

ContentsMethod · 0.80
SetContentsMethod · 0.80
AskForTextMethod · 0.65
SaveMethod · 0.65

Tested by

no test coverage detected