github.com/starshine-sys/bcr@v0.21.0/commands.go (about)

     1  package bcr
     2  
     3  import "sort"
     4  
     5  // Commands is a sortable slice of Command
     6  type Commands []*Command
     7  
     8  func (c Commands) Len() int      { return len(c) }
     9  func (c Commands) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
    10  func (c Commands) Less(i, j int) bool {
    11  	return sort.StringsAreSorted([]string{c[i].Name, c[j].Name})
    12  }