MCPcopy
hub / github.com/bettercap/bettercap / parseSorting

Method parseSorting

modules/utils/view_selector.go:77–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75}
76
77func (s *ViewSelector) parseSorting() (err error) {
78 expr := ""
79 if err, expr = s.owner.StringParam(s.sortName); err != nil {
80 return
81 }
82
83 tokens := s.sortParse.FindAllStringSubmatch(expr, -1)
84 if tokens == nil {
85 return fmt.Errorf("expression '%s' doesn't parse", expr)
86 }
87
88 s.SortField = tokens[0][1]
89 s.Sort = tokens[0][2]
90 s.SortSymbol = tui.Blue("▾")
91 if s.Sort == "asc" {
92 s.SortSymbol = tui.Blue("▴")
93 }
94
95 return
96}
97
98func (s *ViewSelector) Update() (err error) {
99 if err = s.parseFilter(); err != nil {

Callers 4

ViewSelectorForFunction · 0.95
UpdateMethod · 0.95
TestParseSortingFunction · 0.80
BenchmarkParseSortingFunction · 0.80

Calls 1

StringParamMethod · 0.80

Tested by 2

TestParseSortingFunction · 0.64
BenchmarkParseSortingFunction · 0.64