Skip to content
This repository was archived by the owner on Dec 17, 2021. It is now read-only.

Commit 3deea6b

Browse files
committed
commands/flag_sort: Add
1 parent 1257993 commit 3deea6b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

commands/flag_sort.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package commands
2+
3+
import "github.com/codegangsta/cli"
4+
5+
type ByFlagName []cli.Flag
6+
7+
func (flags ByFlagName) Len() int {
8+
return len(flags)
9+
}
10+
11+
func (flags ByFlagName) Swap(i, j int) {
12+
flags[i], flags[j] = flags[j], flags[i]
13+
}
14+
15+
func (flags ByFlagName) Less(i, j int) bool {
16+
return flags[i].String() < flags[j].String()
17+
}

0 commit comments

Comments
 (0)