Skip to content

Commit 577d5bf

Browse files
committed
include all hashes in algorithms list
alternative to #54
1 parent 8be2a68 commit 577d5bf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

opts/opts.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010
"io"
1111
"io/ioutil"
12+
"sort"
1213
"strings"
1314

1415
mh "github.com/multiformats/go-multihash"
@@ -34,8 +35,15 @@ var FlagValues = struct {
3435
Encodings []string
3536
Algorithms []string
3637
}{
37-
Encodings: []string{"raw", "hex", "base58", "base64"},
38-
Algorithms: []string{"sha1", "sha2-256", "sha2-512", "sha3"},
38+
Encodings: []string{"raw", "hex", "base58", "base64"},
39+
Algorithms: func() []string {
40+
names := make([]string, 0, len(mh.Names))
41+
for n := range mh.Names {
42+
names = append(names, n)
43+
}
44+
sort.Strings(names)
45+
return names
46+
}(),
3947
}
4048

4149
// SetupFlags adds multihash related options to given flagset.

0 commit comments

Comments
 (0)