From 58569c1253376434219b595d545e1538bc764006 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Mon, 9 Mar 2020 11:42:48 -0400 Subject: [PATCH] Rename get-zones formats as pretty/dsl/tsv to zone/js/tsv (#687) Co-authored-by: Tom Limoncelli --- commands/getZones.go | 20 ++++++++++---------- docs/get-zones.md | 14 +++++++------- docs/migrating.md | 10 +++++----- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/commands/getZones.go b/commands/getZones.go index e8b497c3b..1d7e1dd6a 100644 --- a/commands/getZones.go +++ b/commands/getZones.go @@ -38,17 +38,17 @@ ARGUMENTS: zone: One or more zones (domains) to download; or "all". FORMATS: - --format=dsl dnsconfig.js format (not perfect, but a decent first draft) - --format=nameonly Just print the zone names - --format=pretty BIND Zonefile format - --format=tsv TAB separated value (useful for AWK) + --format=js dnsconfig.js format (not perfect, but a decent first draft) + --format=zone BIND Zonefile format + --format=tsv TAB separated value (useful for AWK) + --format=nameonly Just print the zone names EXAMPLES: dnscontrol get-zones myr53 ROUTE53 example.com dnscontrol get-zones gmain GANDI_V5 example.comn other.com dnscontrol get-zones cfmain CLOUDFLAREAPI all dnscontrol get-zones -format=tsv bind BIND example.com - dnscontrol get-zones -format=dsl -out=draft.js glcoud GCLOUD example.com`, + dnscontrol get-zones -format=js -out=draft.js glcoud GCLOUD example.com`, } }()) @@ -104,8 +104,8 @@ func (args *GetZoneArgs) flags() []cli.Flag { flags = append(flags, &cli.StringFlag{ Name: "format", Destination: &args.OutputFormat, - Value: "pretty", - Usage: `Output format: dsl pretty tsv nameonly`, + Value: "zone", + Usage: `Output format: js zone tsv nameonly`, }) flags = append(flags, &cli.StringFlag{ Name: "out", @@ -177,7 +177,7 @@ func GetZone(args GetZoneArgs) error { // Write it out: - if args.OutputFormat == "dsl" { + if args.OutputFormat == "js" { fmt.Fprintf(w, `var %s = NewDnsProvider("%s", "%s");`+"\n", args.CredName, args.CredName, args.ProviderName) } @@ -189,12 +189,12 @@ func GetZone(args GetZoneArgs) error { z := prettyzone.PrettySort(recs, zoneName, 0, nil) switch args.OutputFormat { - case "pretty": + case "zone": fmt.Fprintf(w, "$ORIGIN %s.\n", zoneName) prettyzone.WriteZoneFileRC(w, z.Records, zoneName, uint32(args.DefaultTTL), nil) fmt.Fprintln(w) - case "dsl": + case "js": fmt.Fprintf(w, `D("%s", REG_CHANGEME,`, zoneName) fmt.Fprintf(w, "\n\tDnsProvider(%s)", args.CredName) defaultTTL := uint32(args.DefaultTTL) diff --git a/docs/get-zones.md b/docs/get-zones.md index a18770afc..bb71e8f30 100644 --- a/docs/get-zones.md +++ b/docs/get-zones.md @@ -19,7 +19,7 @@ Syntax: dnscontrol get-zones [command options] credkey provider zone [...] --creds value Provider credentials JSON file (default: "creds.json") - --format value Output format: dsl pretty tsv nameonly (default: "pretty") + --format value Output format: js zone tsv nameonly (default: "zone") --out value Instead of stdout, write to this file --ttl value Default TTL (0 picks the zone's most common TTL) (default: 0) @@ -29,10 +29,10 @@ ARGUMENTS: zone: One or more zones (domains) to download; or "all". FORMATS: - --format=dsl dnsconfig.js format (not perfect, but a decent first draft) - --format=nameonly Just print the zone names - --format=pretty BIND Zonefile format - --format=tsv TAB separated value (useful for AWK) + --format=js dnsconfig.js format (not perfect, but a decent first draft) + --format=zone BIND Zonefile format + --format=tsv TAB separated value (useful for AWK) + --format=nameonly Just print the zone names When using `tsv`, the columns are: FQDN (the label with the domain) @@ -41,14 +41,14 @@ When using `tsv`, the columns are: Record Type (A, AAAA, CNAME, etc.) Target and arguments (quoted like in a zonefile) -The --ttl flag applies to pretty and dsl formats. +The --ttl flag applies to zone and js formats. EXAMPLES: dnscontrol get-zones myr53 ROUTE53 example.com dnscontrol get-zones gmain GANDI_V5 example.comn other.com dnscontrol get-zones cfmain CLOUDFLAREAPI all dnscontrol get-zones -format=tsv bind BIND example.com - dnscontrol get-zones -format=dsl -out=draft.js glcoud GCLOUD example.com`, + dnscontrol get-zones -format=js -out=draft.js glcoud GCLOUD example.com`, # Example commands diff --git a/docs/migrating.md b/docs/migrating.md index 3ead689e6..1b1cc158f 100644 --- a/docs/migrating.md +++ b/docs/migrating.md @@ -56,8 +56,8 @@ Example 1: Read a BIND zonefile Most DNS Service Providers have an 'export to zonefile' feature. ``` -dnscontrol get-zones -format=dsl bind BIND example.com -dnscontrol get-zones -format=dsl -out=draft.js bind BIND example.com +dnscontrol get-zones -format=js bind BIND example.com +dnscontrol get-zones -format=js -out=draft.js bind BIND example.com ``` This will read the file `zones/example.com.zone`. The system is a bit @@ -75,8 +75,8 @@ Suppose your `creds.json` file has the name `global_aws` for the provider `ROUTE53`. Your command would look like this: ``` -dnscontrol get-zones -format=dsl global_aws ROUTE53 example.com -dnscontrol get-zones -format=dsl -out=draft.js global_aws ROUTE53 example.com +dnscontrol get-zones -format=js global_aws ROUTE53 example.com +dnscontrol get-zones -format=js -out=draft.js global_aws ROUTE53 example.com ``` Add the contents of `draft.js` to `dnsconfig.js` and edit it as needed. @@ -108,7 +108,7 @@ to convert a zone. Lines that start with `#` are comments. # Note this command uses ">>" to append to dnsconfig.js. Do # not use ">" as that will erase the existing file. - dnscontrol get-zones -format=dsl -out=draft.js bind BIND foo.com + dnscontrol get-zones -format=js -out=draft.js bind BIND foo.com cat >>dnsconfig.js draft.js # Append to dnsconfig.js # dnscontrol preview