MCPcopy Create free account
hub / github.com/diillson/chatcli / formatProcInfo

Function formatProcInfo

cli/proc_tool_adapter.go:106–117  ·  view source on GitHub ↗

formatProcInfo renders one process snapshot as a single line.

(info proc.Info)

Source from the content-addressed store, hash-verified

104
105// formatProcInfo renders one process snapshot as a single line.
106func formatProcInfo(info proc.Info) string {
107 cmd := info.Command
108 if len(cmd) > 80 {
109 cmd = cmd[:77] + "..."
110 }
111 if info.State == proc.StateRunning {
112 return fmt.Sprintf("%s running (pid %d, up %s): %s",
113 info.ID, info.PID, time.Since(info.Started).Round(time.Second), cmd)
114 }
115 return fmt.Sprintf("%s exited (code %d, ran %s): %s",
116 info.ID, info.ExitCode, info.Ended.Sub(info.Started).Round(time.Second), cmd)
117}
118
119// compile-time assertion that the adapter satisfies the plugin interface.
120var _ plugins.ProcAdapter = (*procToolAdapter)(nil)

Callers 3

StatusMethod · 0.85
LogsMethod · 0.85
ListMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected