github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/help.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 (
     8  	"fmt"
     9  
    10  	"github.com/decred/politeia/politeiawww/cmd/shared"
    11  )
    12  
    13  // HelpCmd prints a detailed help message for the specified command.
    14  type HelpCmd struct {
    15  	Args struct {
    16  		Topic string `positional-arg-name:"topic"` // Topic to print help message for
    17  	} `positional-args:"true"`
    18  }
    19  
    20  // Execute executes the help command.
    21  func (cmd *HelpCmd) Execute(args []string) error {
    22  	if cmd.Args.Topic == "" {
    23  		return fmt.Errorf("Specify a command to print a detailed help " +
    24  			"message for.  Example: cmswww help login")
    25  	}
    26  
    27  	switch cmd.Args.Topic {
    28  	case "invite":
    29  		fmt.Printf("%s\n", inviteNewUserHelpMsg)
    30  	case "login":
    31  		fmt.Printf("%s\n", shared.LoginHelpMsg)
    32  	case "logout":
    33  		fmt.Printf("%s\n", shared.LogoutHelpMsg)
    34  	case "changepassword":
    35  		fmt.Printf("%s\n", shared.UserPasswordChangeHelpMsg)
    36  	case "changeusername":
    37  		fmt.Printf("%s\n", shared.UserUsernameChangeHelpMsg)
    38  	case "newcomment":
    39  		fmt.Printf("%s\n", newCommentHelpMsg)
    40  	case "censorcomment":
    41  		fmt.Printf("%s\n", censorCommentHelpMsg)
    42  	case "manageuser":
    43  		fmt.Printf("%s\n", shared.UserManageHelpMsg)
    44  	case "cmsmanageuser":
    45  		fmt.Printf("%s\n", cmsManageUserHelpMsg)
    46  	case "version":
    47  		fmt.Printf("%s\n", shared.VersionHelpMsg)
    48  	case "me":
    49  		fmt.Printf("%s\n", shared.MeHelpMsg)
    50  	case "resetpassword":
    51  		fmt.Printf("%s\n", shared.UserPasswordResetHelpMsg)
    52  	case "updateuserkey":
    53  		fmt.Printf("%s\n", shared.UserKeyUpdateHelpMsg)
    54  	case "users":
    55  		fmt.Printf("%s\n", shared.UsersHelpMsg)
    56  	case "userdetails":
    57  		fmt.Printf("%s\n", userDetailsHelpMsg)
    58  	case "policy":
    59  		fmt.Printf("%s\n", policyHelpMsg)
    60  	case "newinvoice":
    61  		fmt.Printf("%s\n", newInvoiceHelpMsg)
    62  	case "invoicedetails":
    63  		fmt.Printf("%s\n", invoiceDetailsHelpMsg)
    64  	case "editinvoice":
    65  		fmt.Printf("%s\n", editInvoiceHelpMsg)
    66  	case "setinvoicestatus":
    67  		fmt.Printf("%s\n", setInvoiceStatusHelpMsg)
    68  	case "invoicecomments":
    69  		fmt.Printf("%s\n", invoiceCommentsHelpMsg)
    70  	case "admininvoices":
    71  		fmt.Printf("%s\n", adminInvoicesHelpMsg)
    72  	case "userinvoices":
    73  		fmt.Printf("%s\n", userInvoicesHelpMsg)
    74  	case "invoiceexchangerate":
    75  		fmt.Printf("%s\n", invoiceExchangeRateHelpMsg)
    76  	case "dcccomments":
    77  		fmt.Printf("%s\n", dccCommentsHelpMsg)
    78  	case "newdcccomment":
    79  		fmt.Printf("%s\n", newDCCCommentHelpMsg)
    80  	case "batchproposals":
    81  		fmt.Printf("%s\n", batchProposalsHelpMsg)
    82  	case "activevotes":
    83  		fmt.Printf("%s\n", activeVotesHelpMsg)
    84  	case "cmsusers":
    85  		fmt.Printf("%s\n", CMSUsersHelpMsg)
    86  	case "codestats":
    87  		fmt.Printf("%s\n", codeStatsDetailsHelpMsg)
    88  	case "startvote":
    89  		fmt.Printf("%s\n", startVoteHelpMsg)
    90  	case "votedetails":
    91  		fmt.Printf("%s\n", voteDetailsHelpMsg)
    92  
    93  	default:
    94  		fmt.Printf("invalid command: use 'cmswww -h' " +
    95  			"to view a list of valid commands\n")
    96  	}
    97  
    98  	return nil
    99  }