remove.go (624B)
1 package help 2 3 import ( 4 "fmt" 5 "sort" 6 "strings" 7 8 "code.dwrz.net/src/pkg/dqs/category" 9 ) 10 11 var remove = strings.ReplaceAll(portions, "%s", "remove") 12 13 func Remove() string { 14 var str strings.Builder 15 16 str.WriteString(remove) 17 18 var abbreviations = [][2]string{} 19 for abbreviation, name := range category.Abbreviations { 20 abbreviations = append(abbreviations, [2]string{ 21 name, abbreviation, 22 }) 23 } 24 25 sort.Slice(abbreviations, func(i, j int) bool { 26 return abbreviations[i][0] < abbreviations[j][0] 27 }) 28 29 for _, a := range abbreviations { 30 str.WriteString(fmt.Sprintf("%-5s %s\n", a[1], a[0])) 31 } 32 33 return str.String() 34 }