1
0
mirror of https://github.com/go-acme/lego.git synced 2024-12-05 03:58:54 +02:00
lego/cmd/cmd_dnshelp.go

49 lines
1.0 KiB
Go
Raw Normal View History

2019-03-11 18:56:48 +02:00
package cmd
import (
"fmt"
"os"
"strings"
"text/tabwriter"
"github.com/urfave/cli"
)
func createDNSHelp() cli.Command {
return cli.Command{
Name: "dnshelp",
Usage: "Shows additional help for the '--dns' global option",
Action: dnsHelp,
Flags: []cli.Flag{
cli.StringFlag{
Name: "code, c",
Usage: fmt.Sprintf("DNS code: %s", allDNSCodes()),
},
},
2016-05-14 17:11:26 +02:00
}
}
func dnsHelp(ctx *cli.Context) error {
code := ctx.String("code")
if code == "" {
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
fmt.Fprintln(w, `Credentials for DNS providers must be passed through environment variables.`)
fmt.Fprintln(w)
fmt.Fprintln(w, `To display the documentation for a DNS providers:`)
fmt.Fprintln(w)
fmt.Fprintln(w, "\t$ lego dnshelp -c code")
fmt.Fprintln(w)
fmt.Fprintln(w, "All DNS codes:")
fmt.Fprintf(w, "\t%s\n", allDNSCodes())
fmt.Fprintln(w)
fmt.Fprintln(w, "More information: https://go-acme.github.io/lego/dns")
return w.Flush()
}
displayDNSHelp(strings.ToLower(code))
return nil
}