github.com/decred/politeia@v1.4.0/politeiawww/cmd/pictl/userdetails.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 import "github.com/decred/politeia/politeiawww/cmd/shared" 8 9 // userDetailsCmd gets the user details for the specified user. 10 type userDetailsCmd struct { 11 Args struct { 12 UserID string `positional-arg-name:"userid"` // User ID 13 } `positional-args:"true" required:"true"` 14 } 15 16 // Execute executes the userDetailsCmd command. 17 // 18 // This function satisfies the go-flags Commander interface. 19 func (cmd *userDetailsCmd) Execute(args []string) error { 20 udr, err := client.UserDetails(cmd.Args.UserID) 21 if err != nil { 22 return err 23 } 24 return shared.PrintJSON(udr) 25 } 26 27 // userDetailsHelpMsg is the output of the help command when 'userdetails' is 28 // specified. 29 const userDetailsHelpMsg = `userdetails "userid" 30 31 Fetch user details by user id. 32 33 Arguments: 34 1. userid (string, required) User id`