mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
@ -7,7 +7,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/models"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/printer"
|
||||
@ -20,20 +20,21 @@ const (
|
||||
catUtils = "utility"
|
||||
)
|
||||
|
||||
var commands = []cli.Command{}
|
||||
var commands = []*cli.Command{}
|
||||
var version string
|
||||
|
||||
func cmd(cat string, c *cli.Command) bool {
|
||||
c.Category = cat
|
||||
commands = append(commands, *c)
|
||||
commands = append(commands, c)
|
||||
return true
|
||||
}
|
||||
|
||||
var _ = cmd(catDebug, &cli.Command{
|
||||
Name: "version",
|
||||
Usage: "Print version information",
|
||||
Action: func(c *cli.Context) {
|
||||
fmt.Println(version)
|
||||
Action: func(c *cli.Context) error {
|
||||
_, err := fmt.Println(version)
|
||||
return err
|
||||
},
|
||||
})
|
||||
|
||||
@ -46,7 +47,7 @@ func Run(v string) int {
|
||||
app.HideVersion = true
|
||||
app.Usage = "dnscontrol is a compiler and DSL for managing dns zones"
|
||||
app.Flags = []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
&cli.BoolFlag{
|
||||
Name: "v",
|
||||
Usage: "Enable detailed logging",
|
||||
Destination: &printer.DefaultPrinter.Verbose,
|
||||
@ -72,12 +73,12 @@ type GetDNSConfigArgs struct {
|
||||
|
||||
func (args *GetDNSConfigArgs) flags() []cli.Flag {
|
||||
return append(args.ExecuteDSLArgs.flags(),
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Destination: &args.JSONFile,
|
||||
Name: "ir",
|
||||
Usage: "Read IR (json) directly from this file. Do not process DSL at all",
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Destination: &args.JSONFile,
|
||||
Name: "json",
|
||||
Hidden: true,
|
||||
@ -163,20 +164,20 @@ type ExecuteDSLArgs struct {
|
||||
|
||||
func (args *ExecuteDSLArgs) flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "config",
|
||||
Value: "dnsconfig.js",
|
||||
Destination: &args.JSFile,
|
||||
Usage: "File containing dns config in javascript DSL",
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "js",
|
||||
Value: "dnsconfig.js",
|
||||
Hidden: true,
|
||||
Destination: &args.JSFile,
|
||||
Usage: "same as config. for back compatibility",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
&cli.BoolFlag{
|
||||
Name: "dev",
|
||||
Destination: &args.DevMode,
|
||||
Usage: "Use helpers.js from disk instead of embedded copy",
|
||||
@ -192,12 +193,12 @@ type PrintJSONArgs struct {
|
||||
|
||||
func (args *PrintJSONArgs) flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
&cli.BoolFlag{
|
||||
Name: "pretty",
|
||||
Destination: &args.Pretty,
|
||||
Usage: "Pretty print IR JSON",
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "out",
|
||||
Destination: &args.Output,
|
||||
Usage: "File to write IR JSON to (default stdout)",
|
||||
@ -212,7 +213,7 @@ type GetCredentialsArgs struct {
|
||||
|
||||
func (args *GetCredentialsArgs) flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "creds",
|
||||
Destination: &args.CredsFile,
|
||||
Usage: "Provider credentials JSON file",
|
||||
@ -229,13 +230,13 @@ type FilterArgs struct {
|
||||
|
||||
func (args *FilterArgs) flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "providers",
|
||||
Destination: &args.Providers,
|
||||
Usage: `Providers to enable (comma separated list); default is all. Can exclude individual providers from default by adding '"_exclude_from_defaults": "true"' to the credentials file for a provider`,
|
||||
Value: "",
|
||||
},
|
||||
cli.StringFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "domains",
|
||||
Destination: &args.Domains,
|
||||
Usage: `Comma separated list of domain names to include`,
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/providers"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var _ = cmd(catUtils, func() *cli.Command {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/acme"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/normalize"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/printer"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var _ = cmd(catUtils, func() *cli.Command {
|
||||
@ -51,69 +51,69 @@ func (args *GetCertsArgs) flags() []cli.Flag {
|
||||
flags := args.GetDNSConfigArgs.flags()
|
||||
flags = append(flags, args.GetCredentialsArgs.flags()...)
|
||||
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "acme",
|
||||
Destination: &args.ACMEServer,
|
||||
Value: "live",
|
||||
Usage: `ACME server to issue against. Give full directory endpoint. Can also use 'staging' or 'live' for standard Let's Encrpyt endpoints.`,
|
||||
})
|
||||
flags = append(flags, cli.IntFlag{
|
||||
flags = append(flags, &cli.IntFlag{
|
||||
Name: "renew",
|
||||
Destination: &args.RenewUnderDays,
|
||||
Value: 15,
|
||||
Usage: `Renew certs with less than this many days remaining`,
|
||||
})
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "dir",
|
||||
Destination: &args.CertDirectory,
|
||||
Value: ".",
|
||||
Usage: `Directory to store certificates and other data`,
|
||||
})
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "certConfig",
|
||||
Destination: &args.CertsFile,
|
||||
Value: "certs.json",
|
||||
Usage: `Json file containing list of certificates to issue`,
|
||||
})
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "email",
|
||||
Destination: &args.Email,
|
||||
Value: "",
|
||||
Usage: `Email to register with let's encrypt`,
|
||||
})
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "agreeTOS",
|
||||
Destination: &args.AgreeTOS,
|
||||
Usage: `Must provide this to agree to Let's Encrypt terms of service`,
|
||||
})
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "vault",
|
||||
Destination: &args.Vault,
|
||||
Usage: `Store certificates as secrets in hashicorp vault instead of on disk.`,
|
||||
})
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "vaultPath",
|
||||
Destination: &args.VaultPath,
|
||||
Value: "/secret/certs",
|
||||
Usage: `Path in vault to store certificates`,
|
||||
})
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "skip",
|
||||
Destination: &args.IgnoredProviders,
|
||||
Value: "",
|
||||
Usage: `Provider names to not use for challenges (comma separated)`,
|
||||
})
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "verbose",
|
||||
Destination: &args.Verbose,
|
||||
Usage: "Enable detailed logging (deprecated: use the global -v flag)",
|
||||
})
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "notify",
|
||||
Destination: &args.Notify,
|
||||
Usage: `set to true to send notifications to configured destinations`,
|
||||
})
|
||||
flags = append(flags, cli.StringFlag{
|
||||
flags = append(flags, &cli.StringFlag{
|
||||
Name: "only",
|
||||
Destination: &args.Only,
|
||||
Usage: `Only check a single cert. Provide cert name.`,
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/models"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/nameservers"
|
||||
@ -41,12 +41,12 @@ func (args *PreviewArgs) flags() []cli.Flag {
|
||||
flags := args.GetDNSConfigArgs.flags()
|
||||
flags = append(flags, args.GetCredentialsArgs.flags()...)
|
||||
flags = append(flags, args.FilterArgs.flags()...)
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "notify",
|
||||
Destination: &args.Notify,
|
||||
Usage: `set to true to send notifications to configured destinations`,
|
||||
})
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "expect-no-changes",
|
||||
Destination: &args.WarnChanges,
|
||||
Usage: `set to true for non-zero return code if there are changes`,
|
||||
@ -74,7 +74,7 @@ type PushArgs struct {
|
||||
|
||||
func (args *PushArgs) flags() []cli.Flag {
|
||||
flags := args.PreviewArgs.flags()
|
||||
flags = append(flags, cli.BoolFlag{
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: "i",
|
||||
Destination: &args.Interactive,
|
||||
Usage: "Interactive. Confirm or Exclude each correction before they run",
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/models"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/js"
|
||||
|
Reference in New Issue
Block a user