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

     1  // Copyright (c) 2017-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  	"fmt"
     9  
    10  	"github.com/decred/politeia/politeiawww/cmd/shared"
    11  )
    12  
    13  // cmdHelp prints a detailed help message for the specified command.
    14  type cmdHelp struct {
    15  	Args struct {
    16  		Command string `positional-arg-name:"command"`
    17  	} `positional-args:"true" required:"true"`
    18  }
    19  
    20  // Execute executes the cmdHelp command.
    21  //
    22  // This function satisfies the go-flags Commander interface.
    23  func (c *cmdHelp) Execute(args []string) error {
    24  	switch c.Args.Command {
    25  	// Basic commands
    26  	case "version":
    27  		fmt.Printf("%s\n", shared.VersionHelpMsg)
    28  	case "policy":
    29  		fmt.Printf("%s\n", policyHelpMsg)
    30  	case "login":
    31  		fmt.Printf("%s\n", shared.LoginHelpMsg)
    32  	case "logout":
    33  		fmt.Printf("%s\n", shared.LogoutHelpMsg)
    34  	case "me":
    35  		fmt.Printf("%s\n", shared.MeHelpMsg)
    36  
    37  	// User commands
    38  	case "usernew":
    39  		fmt.Printf("%s\n", userNewHelpMsg)
    40  	case "useredit":
    41  		fmt.Printf("%s\n", userEditHelpMsg)
    42  	case "userdetails":
    43  		fmt.Printf("%s\n", userDetailsHelpMsg)
    44  	case "useremailverify":
    45  		fmt.Printf("%s\n", userEmailVerifyHelpMsg)
    46  	case "userregistrationpayment":
    47  		fmt.Printf("%s\n", userRegistrationPaymentHelpMsg)
    48  	case "userproposalpaywall":
    49  		fmt.Printf("%s\n", userProposalPaywallHelpMsg)
    50  	case "userproposalpaywalltx":
    51  		fmt.Printf("%s\n", userProposalPaywallTxHelpMsg)
    52  	case "userproposalcredits":
    53  		fmt.Printf("%s\n", userProposalCreditsHelpMsg)
    54  	case "userpaymentsrescan":
    55  		fmt.Printf("%s\n", userPaymentsRescanHelpMsg)
    56  	case "usermanage":
    57  		fmt.Printf("%s\n", shared.UserManageHelpMsg)
    58  	case "userkeyupdate":
    59  		fmt.Printf("%s\n", shared.UserKeyUpdateHelpMsg)
    60  	case "userverificationresend":
    61  		fmt.Printf("%s\n", userVerificationResendHelpMsg)
    62  	case "userusernamechange":
    63  		fmt.Printf("%s\n", shared.UserUsernameChangeHelpMsg)
    64  	case "userpasswordchange":
    65  		fmt.Printf("%s\n", shared.UserPasswordChangeHelpMsg)
    66  	case "userpasswordreset":
    67  		fmt.Printf("%s\n", shared.UserPasswordResetHelpMsg)
    68  	case "users":
    69  		fmt.Printf("%s\n", shared.UsersHelpMsg)
    70  
    71  		// Proposal commands
    72  	case "proposalpolicy":
    73  		fmt.Printf("%s\n", proposalPolicyHelpMsg)
    74  	case "proposalnew":
    75  		fmt.Printf("%s\n", proposalNewHelpMsg)
    76  	case "proposaledit":
    77  		fmt.Printf("%s\n", proposalEditHelpMsg)
    78  	case "proposalsetstatus":
    79  		fmt.Printf("%s\n", proposalSetStatusHelpMsg)
    80  	case "proposalsetbillingstatus":
    81  		fmt.Printf("%s\n", proposalSetBillingStatusHelpMsg)
    82  	case "proposalbillingstatuschanges":
    83  		fmt.Printf("%s\n", proposalBillingStatusChangesHelpMsg)
    84  	case "proposaldetails":
    85  		fmt.Printf("%s\n", proposalDetailsHelpMsg)
    86  	case "proposaltimestamps":
    87  		fmt.Printf("%s\n", proposalTimestampsHelpMsg)
    88  	case "proposals":
    89  		fmt.Printf("%s\n", proposalsHelpMsg)
    90  	case "proposalsummaries":
    91  		fmt.Printf("%s\n", proposalSummariesHelpMsg)
    92  	case "proposalinv":
    93  		fmt.Printf("%s\n", proposalInvHelpMsg)
    94  	case "proposalinvordered":
    95  		fmt.Printf("%s\n", proposalInvOrderedHelpMsg)
    96  	case "userproposals":
    97  		fmt.Printf("%s\n", userProposalsHelpMsg)
    98  
    99  		// Record commands
   100  	case "recordpolicy":
   101  		fmt.Printf("%s\n", recordPolicyHelpMsg)
   102  
   103  		// Comment commands
   104  	case "commentpolicy":
   105  		fmt.Printf("%s\n", commentPolicyHelpMsg)
   106  	case "commentnew":
   107  		fmt.Printf("%s\n", commentNewHelpMsg)
   108  	case "commentedit":
   109  		fmt.Printf("%s\n", commentEditHelpMsg)
   110  	case "commentvote":
   111  		fmt.Printf("%s\n", commentVoteHelpMsg)
   112  	case "commentcensor":
   113  		fmt.Printf("%s\n", commentCensorHelpMsg)
   114  	case "commentcount":
   115  		fmt.Printf("%s\n", commentCountHelpMsg)
   116  	case "comments":
   117  		fmt.Printf("%s\n", commentsHelpMsg)
   118  	case "commentvotes":
   119  		fmt.Printf("%s\n", commentVotesHelpMsg)
   120  	case "commenttimestamps":
   121  		fmt.Printf("%s\n", commentTimestampsHelpMsg)
   122  
   123  	// Vote commands
   124  	case "votepolicy":
   125  		fmt.Printf("%s\n", votePolicyHelpMsg)
   126  	case "voteauthorize":
   127  		fmt.Printf("%s\n", voteAuthorizeHelpMsg)
   128  	case "votestart":
   129  		fmt.Printf("%s\n", voteStartHelpMsg)
   130  	case "castballot":
   131  		fmt.Printf("%s\n", castBallotHelpMsg)
   132  	case "votedetails":
   133  		fmt.Printf("%s\n", voteDetailsHelpMsg)
   134  	case "voteresults":
   135  		fmt.Printf("%s\n", voteResultsHelpMsg)
   136  	case "votesummaries":
   137  		fmt.Printf("%s\n", voteSummariesHelpMsg)
   138  	case "votesubmissions":
   139  		fmt.Printf("%s\n", voteSubmissionsHelpMsg)
   140  	case "voteinv":
   141  		fmt.Printf("%s\n", voteInvHelpMsg)
   142  	case "votetimestamps":
   143  		fmt.Printf("%s\n", voteTimestampsHelpMsg)
   144  
   145  	// Dev commands
   146  	case "sendfaucettx":
   147  		fmt.Printf("%s\n", sendFaucetTxHelpMsg)
   148  	case "testrun":
   149  		fmt.Printf("%s\n", testRunHelpMsg)
   150  	case "seedproposals":
   151  		fmt.Printf("%s\n", seedProposalsHelpMsg)
   152  	case "votetestsetup":
   153  		fmt.Printf("%s\n", voteTestSetupHelpMsg)
   154  	case "votetest":
   155  		fmt.Printf("%s\n", voteTestHelpMsg)
   156  	case "rfptest":
   157  		fmt.Printf("%s\n", RFPTestHelpMsg)
   158  	case "legacytest":
   159  		fmt.Printf("%s\n", legacyTestHelpMsg)
   160  
   161  	default:
   162  		fmt.Printf("invalid command: use the -h,--help flag to view the " +
   163  			"full list of valid commands\n")
   164  	}
   165  
   166  	return nil
   167  }