aboutsummaryrefslogtreecommitdiff
path: root/cmd_check.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd_check.go')
-rw-r--r--cmd_check.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/cmd_check.go b/cmd_check.go
new file mode 100644
index 0000000..2dfb786
--- /dev/null
+++ b/cmd_check.go
@@ -0,0 +1,43 @@
+package main
+
+import (
+ "context"
+ "flag"
+ "fmt"
+
+ "github.com/google/subcommands"
+)
+
+// Usage: signify -C [-q] -p pubkey -x sigfile [file ...]
+
+type checkCommand struct {
+ quiet bool
+ pubFile string
+ sigFile string
+}
+
+func (c *checkCommand) Name() string { return "check" }
+func (c *checkCommand) Synopsis() string { return "check signatures" }
+func (c *checkCommand) Usage() string {
+ return "check [-q] -p pubkey -x sigfile [file ...]\n"
+}
+
+func (c *checkCommand) SetFlags(f *flag.FlagSet) {
+ f.BoolVar(&c.quiet, "q", false, "quiet mode")
+ f.StringVar(&c.pubFile, "p", "", "public key file (required)")
+ f.StringVar(&c.sigFile, "x", "", "signature file (required)")
+}
+
+func (c *checkCommand) Execute(ctx context.Context, f *flag.FlagSet, args ...interface{}) subcommands.ExitStatus {
+ if c.pubFile == "" || c.sigFile == "" {
+ f.Usage()
+ return subcommands.ExitUsageError
+ }
+ files := make([]string, f.NArg())
+ for i := 0; i < f.NArg(); i++ {
+ files[i] = f.Arg(i)
+ }
+ fmt.Println(files)
+ // TODO
+ return subcommands.ExitSuccess
+}