MCPcopy Index your code
hub / github.com/larksuite/cli / ParseFormat

Function ParseFormat

internal/output/format_type.go:21–34  ·  view source on GitHub ↗

ParseFormat parses a format string into a Format value. The second return value is false if the format string was not recognized, in which case FormatJSON is returned as default.

(s string)

Source from the content-addressed store, hash-verified

19// The second return value is false if the format string was not recognized,
20// in which case FormatJSON is returned as default.
21func ParseFormat(s string) (Format, bool) {
22 switch strings.ToLower(s) {
23 case "json", "":
24 return FormatJSON, true
25 case "ndjson":
26 return FormatNDJSON, true
27 case "table":
28 return FormatTable, true
29 case "csv":
30 return FormatCSV, true
31 default:
32 return FormatJSON, false
33 }
34}
35
36// String returns the string representation of a Format.
37func (f Format) String() string {

Callers 5

serviceMethodRunFunction · 0.92
apiRunFunction · 0.92
outFormatMethod · 0.92
TestParseFormatFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestParseFormatFunction · 0.68