MCPcopy Index your code
hub / github.com/helm/helm / executeActionCommandStdinC

Function executeActionCommandStdinC

pkg/cmd/helpers_test.go:87–128  ·  view source on GitHub ↗
(store *storage.Storage, in *os.File, cmd string)

Source from the content-addressed store, hash-verified

85}
86
87func executeActionCommandStdinC(store *storage.Storage, in *os.File, cmd string) (*cobra.Command, string, error) {
88 args, err := shellwords.Parse(cmd)
89 if err != nil {
90 return nil, "", err
91 }
92
93 buf := new(bytes.Buffer)
94
95 actionConfig := &action.Configuration{
96 Releases: store,
97 KubeClient: &kubefake.PrintingKubeClient{Out: io.Discard},
98 Capabilities: common.DefaultCapabilities,
99 }
100
101 root, err := newRootCmdWithConfig(actionConfig, buf, args, SetupLogging)
102 if err != nil {
103 return nil, "", err
104 }
105
106 root.SetOut(buf)
107 root.SetErr(buf)
108 root.SetArgs(args)
109
110 oldStdin := os.Stdin
111 defer func() {
112 os.Stdin = oldStdin
113 }()
114
115 if in != nil {
116 root.SetIn(in)
117 os.Stdin = in
118 }
119
120 if mem, ok := store.Driver.(*driver.Memory); ok {
121 mem.SetNamespace(settings.Namespace())
122 }
123 c, err := root.ExecuteC()
124
125 result := buf.String()
126
127 return c, result, err
128}
129
130// cmdTestCase describes a test case that works with releases.
131type cmdTestCase struct {

Calls 4

newRootCmdWithConfigFunction · 0.85
NamespaceMethod · 0.65
SetNamespaceMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…