MCPcopy Create free account
hub / github.com/openclaw/gogcli / resolveTextInput

Function resolveTextInput

internal/cmd/docs_helpers.go:62–80  ·  view source on GitHub ↗
(ctx context.Context, text, file string, kctx *kong.Context)

Source from the content-addressed store, hash-verified

60)
61
62func resolveTextInput(ctx context.Context, text, file string, kctx *kong.Context) (string, bool, error) {
63 file = strings.TrimSpace(file)
64 textProvided := text != "" || flagProvided(kctx, "text")
65 fileProvided := file != "" || flagProvided(kctx, "file")
66 if textProvided && fileProvided {
67 return "", true, usage("use only one of --text or --file")
68 }
69 if fileProvided {
70 b, err := readTextInput(ctx, file)
71 if err != nil {
72 return "", true, err
73 }
74 return string(b), true, nil
75 }
76 if textProvided {
77 return text, true, nil
78 }
79 return text, false, nil
80}
81
82func readTextInput(ctx context.Context, path string) ([]byte, error) {
83 if path == "-" {

Callers 5

RunMethod · 0.85
resolveWriteTextMethod · 0.85
RunMethod · 0.85
runDocsSegmentCreateFunction · 0.85
RunMethod · 0.85

Calls 3

flagProvidedFunction · 0.85
usageFunction · 0.85
readTextInputFunction · 0.85

Tested by

no test coverage detected