2019-03-11 18:56:48 +02:00
|
|
|
package cmd
|
2015-06-08 02:36:07 +02:00
|
|
|
|
|
|
|
import (
|
2016-03-18 02:32:24 +02:00
|
|
|
"fmt"
|
2015-06-08 02:36:07 +02:00
|
|
|
"os"
|
2019-03-08 20:47:06 +02:00
|
|
|
"strings"
|
2016-03-18 02:32:24 +02:00
|
|
|
"text/tabwriter"
|
2015-06-08 02:36:07 +02:00
|
|
|
|
2016-07-13 21:03:47 +02:00
|
|
|
"github.com/urfave/cli"
|
2015-06-08 02:36:07 +02:00
|
|
|
)
|
|
|
|
|
2018-12-06 23:50:17 +02:00
|
|
|
func createDNSHelp() cli.Command {
|
|
|
|
return cli.Command{
|
|
|
|
Name: "dnshelp",
|
2019-03-08 20:47:06 +02:00
|
|
|
Usage: "Shows additional help for the '--dns' global option",
|
2018-12-06 23:50:17 +02:00
|
|
|
Action: dnsHelp,
|
2019-03-08 20:47:06 +02:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "code, c",
|
|
|
|
Usage: fmt.Sprintf("DNS code: %s", allDNSCodes()),
|
|
|
|
},
|
|
|
|
},
|
2016-05-14 17:11:26 +02:00
|
|
|
}
|
2015-06-08 02:36:07 +02:00
|
|
|
}
|
2016-03-18 02:32:24 +02:00
|
|
|
|
2019-03-08 20:47:06 +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)
|
2019-03-11 17:54:35 +02:00
|
|
|
fmt.Fprintln(w, "More information: https://go-acme.github.io/lego/dns")
|
2019-03-08 20:47:06 +02:00
|
|
|
|
|
|
|
return w.Flush()
|
|
|
|
}
|
2016-03-18 02:32:24 +02:00
|
|
|
|
2019-03-08 20:47:06 +02:00
|
|
|
displayDNSHelp(strings.ToLower(code))
|
2016-05-12 19:52:59 +02:00
|
|
|
|
|
|
|
return nil
|
2016-03-18 02:32:24 +02:00
|
|
|
}
|