Documentation ¶
Overview ¶
Package opts helps to write commands which may take multihash options.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMatch = errors.New("multihash checksums did not match")
)
package errors
View Source
var FlagValues = struct { Encodings []string Algorithms []string }{ Encodings: []string{"raw", "hex", "base58", "base64"}, Algorithms: []string{"sha1", "sha2-256", "sha2-512", "sha3"}, }
FlagValues are the values the various option flags can take.
Functions ¶
Types ¶
type Options ¶
type Options struct { Encoding string Algorithm string AlgorithmCode int Length int // contains filtered or unexported fields }
Options is a struct used to parse cli flags.
func SetupFlags ¶
SetupFlags adds multihash related options to given flagset.
func (*Options) Check ¶
Check reads all the data in r, calculates its multihash, and checks it matches h1
func (*Options) Parse ¶
Parse parses the values of flags from given argument slice. It is equivalent to flags.Parse(args)
func (*Options) ParseError ¶
ParseError checks the parsed options for errors.
Click to show internal directories.
Click to hide internal directories.