Documentation
¶
Overview ¶
Package flagx contains a helper type for parsing CAS keys from command line arguments.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyParam ¶
type KeyParam struct {
// contains filtered or unexported fields
}
KeyParam is a wrapper for cas.Key that is compatible with the flag.Value interface, without compromising the immutability promise of Key.
Example ¶
package main
import (
"flag"
"fmt"
"bazil.org/bazil/cas/flagx"
)
func main() {
var kp flagx.KeyParam
var fl flag.FlagSet
fl.Var(&kp, "key", "blah blah")
fl.Parse([]string{"-key=095920158295e252b3cb4728713a987875d210eca00d5b69e89e1d2e2e473153ec3de87ada31787b0d5080cdb0f7dcf15ea1f03cec5fef76df027bcc7d57b337"})
k := kp.Key()
fmt.Println(k)
}
Output: 095920158295e252b3cb4728713a987875d210eca00d5b69e89e1d2e2e473153ec3de87ada31787b0d5080cdb0f7dcf15ea1f03cec5fef76df027bcc7d57b337
func (*KeyParam) Key ¶
Key returns a copy of the current value of the KeyParam.
As usual with cas.Key, the returned value is promised to be immutable.
Click to show internal directories.
Click to hide internal directories.