github.hscsec.cn/hashicorp/consul@v1.4.5/command/tls/tls.go (about)

     1  package tls
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/hashicorp/consul/command/flags"
     7  	"github.com/mitchellh/cli"
     8  )
     9  
    10  func New() *cmd {
    11  	return &cmd{}
    12  }
    13  
    14  type cmd struct{}
    15  
    16  func (c *cmd) Run(args []string) int {
    17  	return cli.RunResultHelp
    18  }
    19  
    20  func (c *cmd) Synopsis() string {
    21  	return synopsis
    22  }
    23  
    24  func (c *cmd) Help() string {
    25  	return flags.Usage(help, nil)
    26  }
    27  
    28  func FileDoesNotExist(file string) bool {
    29  	if _, err := os.Stat(file); os.IsNotExist(err) {
    30  		return true
    31  	}
    32  	return false
    33  }
    34  
    35  const synopsis = `Builtin helpers for creating CAs and certificates`
    36  const help = `
    37  Usage: consul tls <subcommand> <subcommand> [options]
    38  
    39    This command has subcommands for interacting with Consul TLS.
    40  
    41    Here are some simple examples, and more detailed examples are available
    42    in the subcommands or the documentation.
    43  
    44    Create a CA
    45  
    46      $ consul tls ca create
    47  
    48    Create a server certificate
    49  
    50      $ consul tls cert create -server
    51  
    52    Create a client certificate
    53  
    54      $ consul tls cert create -client
    55  
    56    For more examples, ask for subcommand help or view the documentation.
    57  `