Commit 182b39a4 authored by Audrius Butkevicius's avatar Audrius Butkevicius

Sort commands

parent 418bcf0e
......@@ -2,9 +2,16 @@ package main
import (
"github.com/AudriusButkevicius/cli"
"sort"
"time"
)
type ByAlphabet []cli.Command
func (a ByAlphabet) Len() int { return len(a) }
func (a ByAlphabet) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByAlphabet) Less(i, j int) bool { return a[i].Name < a[j].Name }
var cliCommands []cli.Command
func main() {
......@@ -44,6 +51,7 @@ func main() {
},
}
sort.Sort(ByAlphabet(cliCommands))
app.Commands = cliCommands
app.RunAndExitOnError()
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment