aboutsummaryrefslogtreecommitdiff
path: root/sign.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-05-04 16:48:53 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-05-04 16:48:53 +0200
commit4a7233c2ee6c6d586f3523cdeab43747750833cb (patch)
tree4b401d1814ece0ff9764685704511eff1aec5793 /sign.go
parent7e2b496200d8281f28bb12997d9f8223d25fcb40 (diff)
pass args
Diffstat (limited to 'sign.go')
-rw-r--r--sign.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/sign.go b/sign.go
index f65adb3..368108f 100644
--- a/sign.go
+++ b/sign.go
@@ -4,7 +4,6 @@ import (
"errors"
"flag"
"io/ioutil"
- "os"
"dim13.org/signify/ask"
"dim13.org/signify/file"
@@ -13,21 +12,21 @@ import (
// Usage: signify -S [-ez] [-x sigfile] -s seckey -m message
-func sign() error {
- args := flag.NewFlagSet("sign", flag.ExitOnError)
+func sign(args []string) error {
+ opts := flag.NewFlagSet("sign", flag.ExitOnError)
var (
- embedded = args.Bool("e", false, "Embed the message")
- zip = args.Bool("z", false, "Sign gzip archive")
- sigFile = args.String("x", "", "Signature file")
- encFile = args.String("s", "", "Secret file (required)")
- msgFile = args.String("m", "", "Message file (required)")
+ embedded = opts.Bool("e", false, "Embed the message")
+ zip = opts.Bool("z", false, "Sign gzip archive")
+ sigFile = opts.String("x", "", "Signature file")
+ encFile = opts.String("s", "", "Secret file (required)")
+ msgFile = opts.String("m", "", "Message file (required)")
)
- args.Parse(os.Args[2:])
+ opts.Parse(args)
if *embedded && *zip {
return errors.New("can't combine -e and -z options")
}
if *encFile == "" || *msgFile == "" {
- args.Usage()
+ opts.Usage()
return nil
}
if *sigFile == "" {