MCPcopy Create free account
hub / github.com/cli/cli / getBody

Function getBody

pkg/cmd/variable/set/set.go:265–285  ·  view source on GitHub ↗
(opts *SetOptions)

Source from the content-addressed store, hash-verified

263}
264
265func getBody(opts *SetOptions) (string, error) {
266 if opts.Body != "" {
267 return opts.Body, nil
268 }
269
270 if opts.IO.CanPrompt() {
271 bodyInput, err := opts.Prompter.Input("Paste your variable", "")
272 if err != nil {
273 return "", err
274 }
275 fmt.Fprintln(opts.IO.Out)
276 return bodyInput, nil
277 }
278
279 body, err := io.ReadAll(opts.IO.In)
280 if err != nil {
281 return "", fmt.Errorf("failed to read from standard input: %w", err)
282 }
283
284 return string(bytes.TrimRight(body, "\r\n")), nil
285}
286
287func getRepoIds(client *api.Client, host, owner string, repositoryNames []string) ([]int64, error) {
288 if len(repositoryNames) == 0 {

Callers 3

getVariablesFromOptionsFunction · 0.70
Test_getBody_promptFunction · 0.70
Test_getBodyFunction · 0.70

Calls 3

CanPromptMethod · 0.80
InputMethod · 0.65
ErrorfMethod · 0.65

Tested by 2

Test_getBody_promptFunction · 0.56
Test_getBodyFunction · 0.56