MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / MarshalJSON

Method MarshalJSON

lib/crontab.go:391–410  ·  view source on GitHub ↗

MarshalJSON implements custom JSON marshaling to include both Filename and DisplayName

()

Source from the content-addressed store, hash-verified

389
390// MarshalJSON implements custom JSON marshaling to include both Filename and DisplayName
391func (c Crontab) MarshalJSON() ([]byte, error) {
392 type Alias Crontab
393 timezone := ""
394 if c.TimezoneLocationName != nil {
395 timezone = c.TimezoneLocationName.Name
396 }
397 return json.Marshal(&struct {
398 Alias
399 DisplayName string `json:"display_name"`
400 Timezone string `json:"timezone,omitempty"`
401 Shell string `json:"shell,omitempty"`
402 Lines []*Line `json:"lines"`
403 }{
404 Alias: Alias(c),
405 DisplayName: c.DisplayName(),
406 Timezone: timezone,
407 Shell: c.Shell,
408 Lines: c.Lines,
409 })
410}
411
412type Line struct {
413 IsComment bool

Callers

nothing calls this directly

Calls 2

DisplayNameMethod · 0.95
AliasTypeAlias · 0.85

Tested by

no test coverage detected