github.com/decred/politeia@v1.4.0/politeiawww/cmd/pictl/cmdactivevotes.go (about)

     1  // Copyright (c) 2017-2019 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  // cmdActiveVotes retreives all proposals that are currently being voted on.
     8  type cmdActiveVotes struct{}
     9  
    10  // Execute executes the active votes command.
    11  func (cmd *cmdActiveVotes) Execute(args []string) error {
    12  	// Send request
    13  	avr, err := client.ActiveVotes()
    14  	if err != nil {
    15  		return err
    16  	}
    17  
    18  	// Remove the ticket snapshots from the response so that the
    19  	// output is legible
    20  	if !cfg.RawJSON {
    21  		for k := range avr.Votes {
    22  			avr.Votes[k].StartVoteReply.EligibleTickets = []string{
    23  				"removed by politeiawwwcli for readability",
    24  			}
    25  		}
    26  	}
    27  
    28  	// Print response details
    29  	printJSON(avr)
    30  
    31  	return nil
    32  }