MCPcopy Index your code
hub / github.com/jetify-com/devbox / MarshalJSON

Method MarshalJSON

internal/devbox/shellcmd/command.go:82–91  ·  view source on GitHub ↗

MarshalJSON marshals shell commands according to s.MarshalAs. It marshals commands to a string by joining s.Cmds with newlines.

()

Source from the content-addressed store, hash-verified

80// MarshalJSON marshals shell commands according to s.MarshalAs. It marshals
81// commands to a string by joining s.Cmds with newlines.
82func (s Commands) MarshalJSON() ([]byte, error) {
83 switch s.MarshalAs {
84 case CmdArray:
85 return cuecfg.MarshalJSON(s.Cmds)
86 case CmdString:
87 return cuecfg.MarshalJSON(s.String())
88 default:
89 panic(fmt.Sprintf("invalid command format: %s", s.MarshalAs))
90 }
91}
92
93// UnmarshalJSON unmarshals shell commands from a string, an array of strings,
94// or null. When the JSON value is a string, it unmarshals into the first index

Callers

nothing calls this directly

Calls 2

StringMethod · 0.95
MarshalJSONFunction · 0.92

Tested by

no test coverage detected