MCPcopy Index your code
hub / github.com/dnote/dnote / formatBody

Function formatBody

pkg/cli/cmd/view/book.go:54–65  ·  view source on GitHub ↗

formatBody returns an excerpt of the given raw note content and a boolean indicating if the returned string has been excertped

(noteBody string)

Source from the content-addressed store, hash-verified

52// formatBody returns an excerpt of the given raw note content and a boolean
53// indicating if the returned string has been excertped
54func formatBody(noteBody string) (string, bool) {
55 trimmed := strings.TrimRight(noteBody, "\r\n")
56 newlineIdx := getNewlineIdx(trimmed)
57
58 if newlineIdx > -1 {
59 ret := strings.Trim(trimmed[0:newlineIdx], " ")
60
61 return ret, true
62 }
63
64 return strings.Trim(trimmed, " "), false
65}
66
67func printBookLine(w io.Writer, info bookInfo, nameOnly bool) {
68 if nameOnly {

Callers 2

TestFormatBodyFunction · 0.85
listNotesFunction · 0.85

Calls 1

getNewlineIdxFunction · 0.85

Tested by 1

TestFormatBodyFunction · 0.68