MCPcopy Create free account
hub / github.com/alecthomas/devtodo2 / formatTask

Function formatTask

consoleview.go:111–131  ·  view source on GitHub ↗
(width, depth int, task Task, options *ViewOptions)

Source from the content-addressed store, hash-verified

109}
110
111func formatTask(width, depth int, task Task, options *ViewOptions) {
112 indent := depth*4 + 4
113 width -= indent
114 state := taskState(task)
115 fmt.Printf("%s%s%c%2d.%s%s", strings.Repeat(" ", depth), NUMBER_COLOR, state,
116 task.ID()+1, RESET, colourPriorityMap[task.Priority()])
117 text := task.Text()
118 trimmed := false
119 if options.Summarise {
120 if len(text) > width {
121 text = strings.TrimSpace(text[:width-1])
122 trimmed = true
123 }
124 }
125 printWrappedText(text, width, indent)
126 if trimmed {
127 fmt.Printf("%s+%s\n", TITLE_COLOUR, RESET)
128 } else {
129 fmt.Printf("%s\n", RESET)
130 }
131}
132
133func consoleDisplayTask(width, depth int, task Task, options *ViewOptions) {
134 if depth >= 0 && (!options.ShowAll && !task.CompletionTime().IsZero()) {

Callers 1

consoleDisplayTaskFunction · 0.85

Calls 5

taskStateFunction · 0.85
printWrappedTextFunction · 0.85
IDMethod · 0.65
PriorityMethod · 0.65
TextMethod · 0.65

Tested by

no test coverage detected