...
1 package main
2
3 import (
4 "github.com/flynn/go-docopt"
5 "github.com/theupdateframework/go-tuf"
6 )
7
8 func init() {
9 register("timestamp", cmdTimestamp, `
10 usage: tuf timestamp [--expires=<days>]
11
12 Update the timestamp metadata file.
13
14 Alternatively, passphrases can be set via environment variables in the
15 form of TUF_{{ROLE}}_PASSPHRASE
16
17 Options:
18 --expires=<days> Set the timestamp metadata file to expire <days> days from now.
19 `)
20 }
21
22 func cmdTimestamp(args *docopt.Args, repo *tuf.Repo) error {
23 if arg := args.String["--expires"]; arg != "" {
24 expires, err := parseExpires(arg)
25 if err != nil {
26 return err
27 }
28 return repo.TimestampWithExpires(expires)
29 }
30 return repo.Timestamp()
31 }
32
View as plain text