...

Source file src/github.com/theupdateframework/go-tuf/cmd/tuf/get_threshold.go

Documentation: github.com/theupdateframework/go-tuf/cmd/tuf

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/flynn/go-docopt"
     8  	"github.com/theupdateframework/go-tuf"
     9  )
    10  
    11  func init() {
    12  	register("get-threshold", cmdGetThreshold, `
    13  usage: tuf get-threshold <role>
    14  
    15  Gets the threshold for a role.  
    16  `)
    17  }
    18  
    19  func cmdGetThreshold(args *docopt.Args, repo *tuf.Repo) error {
    20  	role := args.String["<role>"]
    21  
    22  	threshold, err := repo.GetThreshold(role)
    23  	if err != nil {
    24  		return err
    25  	}
    26  
    27  	fmt.Fprintf(os.Stdout, "The threshold for %s role is %d", role, threshold)
    28  	return nil
    29  }
    30  

View as plain text