github.com/decred/politeia@v1.4.0/politeiawww/cmd/pictl/cmdcommentpolicy.go (about) 1 // Copyright (c) 2020-2021 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 pclient "github.com/decred/politeia/politeiawww/client" 9 ) 10 11 // cmdCommentPolicy retrieves the comments API policy. 12 type cmdCommentPolicy struct{} 13 14 // Execute executes the cmdCommentPolicy command. 15 // 16 // This function satisfies the go-flags Commander interface. 17 func (c *cmdCommentPolicy) Execute(args []string) error { 18 // Setup client 19 opts := pclient.Opts{ 20 HTTPSCert: cfg.HTTPSCert, 21 Verbose: cfg.Verbose, 22 RawJSON: cfg.RawJSON, 23 } 24 pc, err := pclient.New(cfg.Host, opts) 25 if err != nil { 26 return err 27 } 28 29 // Get policy 30 pr, err := pc.CommentPolicy() 31 if err != nil { 32 return err 33 } 34 35 // Print policy 36 printJSON(pr) 37 38 return nil 39 } 40 41 // commentEditHelpMsg is the printed to stdout by the help command. 42 const commentPolicyHelpMsg = `commentpolicy 43 44 Fetch the comments API policy.`