Sort flags in create output

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
Nathan LeClaire 2015-01-05 13:20:51 -08:00
parent 0b98347ed9
commit 2d435d41f1
2 changed files with 19 additions and 0 deletions

View File

@ -112,6 +112,8 @@ func GetCreateFlags() []cli.Flag {
} }
} }
sort.Sort(ByFlagName(flags))
return flags return flags
} }

17
drivers/flag_sort.go Normal file
View File

@ -0,0 +1,17 @@
package drivers
import "github.com/codegangsta/cli"
type ByFlagName []cli.Flag
func (flags ByFlagName) Len() int {
return len(flags)
}
func (flags ByFlagName) Swap(i, j int) {
flags[i], flags[j] = flags[j], flags[i]
}
func (flags ByFlagName) Less(i, j int) bool {
return flags[i].String() < flags[j].String()
}