Skip to content

Commit

Permalink
Sort binaries by path in bin ls (#74)
Browse files Browse the repository at this point in the history
Fixes #69.

Signed-off-by: Sune Keller <sune.keller+gitlab.com@gmail.com>

Co-authored-by: Sune Keller <sune.keller+gitlab.com@gmail.com>
  • Loading branch information
sirlatrom and sirlatrom authored Mar 21, 2021
1 parent 4bd5e82 commit 058bb2e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"sort"

"github.com/WeiZhang555/tabwriter"
"github.com/fatih/color"
Expand Down Expand Up @@ -32,7 +33,13 @@ func newListCmd() *listCmd {
cfg := config.Get()

fmt.Fprintf(w, "\n %s\t%s\t%s\t%s", "Path", "Version", "URL", "Status")
for _, b := range cfg.Bins {
binPaths := []string{}
for k := range cfg.Bins {
binPaths = append(binPaths, k)
}
sort.Strings(binPaths)
for _, k := range binPaths {
b := cfg.Bins[k]

_, err := os.Stat(b.Path)

Expand Down

0 comments on commit 058bb2e

Please sign in to comment.