MCPcopy Index your code
hub / github.com/cortesi/modd / shortCommand

Function shortCommand

proc.go:14–26  ·  view source on GitHub ↗

shortCommand shortens a command to a name we can use in a notification header.

(command string)

Source from the content-addressed store, hash-verified

12// shortCommand shortens a command to a name we can use in a notification
13// header.
14func shortCommand(command string) string {
15 ret := command
16 parts := strings.Split(command, "\n")
17 for _, i := range parts {
18 i = strings.TrimLeft(i, " \t#")
19 i = strings.TrimRight(i, " \t\\")
20 if i != "" {
21 ret = i
22 break
23 }
24 }
25 return ret
26}
27
28// niceHeader tries to produce a nicer process name. We condense whitespace to
29// make commands split over multiple lines with indentation more legible, and

Callers 2

TestShortCommandFunction · 0.85
niceHeaderFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestShortCommandFunction · 0.68