Skip to content

Commit

Permalink
include all hashes in algorithms list
Browse files Browse the repository at this point in the history
alternative to #54
  • Loading branch information
Stebalien committed Dec 18, 2017
1 parent 64b5aa8 commit 55698d8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions opts/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"io"
"io/ioutil"
"sort"
"strings"

mh "github.com/multiformats/go-multihash"
Expand All @@ -34,8 +35,15 @@ var FlagValues = struct {
Encodings []string
Algorithms []string
}{
Encodings: []string{"raw", "hex", "base58", "base64"},
Algorithms: []string{"sha1", "sha2-256", "sha2-512", "sha3"},
Encodings: []string{"raw", "hex", "base58", "base64"},
Algorithms: func() []string {
names := make([]string, 0, len(mh.Names))
for n := range mh.Names {
names = append(names, n)
}
sort.Strings(names)
return names
}(),
}

// SetupFlags adds multihash related options to given flagset.
Expand Down

0 comments on commit 55698d8

Please sign in to comment.