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