github.com/azunymous/cdx@v0.0.0-20201122180449-fbb46cc4d252/commands/options/patch.go (about)

     1  package options
     2  
     3  import "github.com/spf13/cobra"
     4  
     5  // App struct contains options regarding the application
     6  type Patch struct {
     7  	Password string
     8  	Reset    bool
     9  	Insecure bool
    10  	Target   string
    11  	Port     int
    12  }
    13  
    14  func AddPasswordArg(cmd *cobra.Command, r *Patch) {
    15  	cmd.Flags().StringVarP(&r.Password, "password", "p", "", "Password to use to encrypt/decrypt patch. Plaintext by default")
    16  }
    17  
    18  func AddResetArg(cmd *cobra.Command, p *Patch) {
    19  	cmd.Flags().BoolVarP(&p.Reset, "reset", "r", true, "Reset (hard) to origin/master before applying patch")
    20  }
    21  
    22  func AddInsecureArg(cmd *cobra.Command, p *Patch) {
    23  	cmd.Flags().BoolVarP(&p.Insecure, "insecure", "i", false, "Insecure connection to GRPC server")
    24  }
    25  
    26  const defaultServer = "cdx.vvv.run:443"
    27  
    28  func AddTargetArg(cmd *cobra.Command, r *Patch) {
    29  	cmd.Flags().StringVarP(&r.Target, "uri", "u", defaultServer, "URI to use for pushing and pulling patches")
    30  }
    31  
    32  func AddPortArg(cmd *cobra.Command, r *Patch) {
    33  	cmd.Flags().IntVarP(&r.Port, "port", "p", 19443, "Server port to use")
    34  }