1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00
This commit is contained in:
Tom Limoncelli
2023-01-28 11:09:38 -05:00
committed by GitHub
parent f9be836e31
commit 8249a4b95b
7 changed files with 15 additions and 16 deletions

View File

@ -24,9 +24,7 @@ func generateFeatureMatrix() error {
func markdownTable(matrix *FeatureMatrix) (string, error) {
var tableHeaders []string
tableHeaders = append(tableHeaders, "Provider name")
for _, featureName := range matrix.Features {
tableHeaders = append(tableHeaders, featureName)
}
tableHeaders = append(tableHeaders, matrix.Features...)
var tableData [][]string
for _, providerName := range allProviderNames() {
@ -58,9 +56,9 @@ func featureEmoji(
return "❔"
}
if featureMap[featureName].HasFeature == true {
if featureMap[featureName].HasFeature {
return "✅"
} else if featureMap[featureName].Unimplemented == true {
} else if featureMap[featureName].Unimplemented {
return "❔"
}
return "❌"
@ -69,7 +67,7 @@ func featureEmoji(
func matrixData() *FeatureMatrix {
const (
OfficialSupport = "Official Support"
ProviderDnsProvider = "DNS Provider"
ProviderDNSProvider = "DNS Provider"
ProviderRegistrar = "Registrar"
DomainModifierAlias = "ALIAS"
DomainModifierDnssec = "AUTODNSSEC"
@ -91,7 +89,7 @@ func matrixData() *FeatureMatrix {
Providers: map[string]FeatureMap{},
Features: []string{
OfficialSupport,
ProviderDnsProvider,
ProviderDNSProvider,
ProviderRegistrar,
DomainModifierAlias,
DomainModifierDnssec,
@ -152,7 +150,7 @@ func matrixData() *FeatureMatrix {
true,
)
featureMap.SetSimple(
ProviderDnsProvider,
ProviderDNSProvider,
false,
func() bool { return providers.DNSProviderTypes[providerName].Initializer != nil },
)

View File

@ -155,6 +155,7 @@ func generateFunctionTypes() (string, error) {
return content, nil
}
// Function is a struct the stores information about functions.
type Function struct {
Name string
Params []Param
@ -164,6 +165,7 @@ type Function struct {
Description string
}
// Param is a struct that stores a parameter.
type Param struct {
Name string
Type string
@ -193,9 +195,8 @@ func (f Function) formatParams() string {
}
if f.ObjectParam {
return "opts: { " + strings.Join(params, "; ") + " }"
} else {
return strings.Join(params, ", ")
}
return strings.Join(params, ", ")
}
func (f Function) docs() string {

View File

@ -1,7 +1,7 @@
package commands
import (
_ "embed"
_ "embed" // Required by go:embed
"os"
versionInfo "github.com/StackExchange/dnscontrol/v3/pkg/version"
@ -40,6 +40,7 @@ func (args *TypesArgs) flags() []cli.Flag {
//go:embed types/dnscontrol.d.ts
var dtsContent string
// WriteTypes creates the types file.
func WriteTypes(args TypesArgs) error {
file, err := os.Create(args.DTSFile)
if err != nil {

View File

@ -252,8 +252,6 @@ func filterBy(s []targetConfig, m map[string]*targetConfig) []targetConfig {
// copy and increment index
s[i] = x
i++
} else {
//fmt.Printf("DEBUG: comp %q YES\n", x.compareable)
}
}
// // Prevent memory leak by erasing truncated values

View File

@ -1,6 +1,6 @@
package diff2
// Return the highest valid index for an array. The equiv of len(s)-1, but with
// highest returns the highest valid index for an array. The equiv of len(s)-1, but with
// less likelihood that you'll commit an off-by-one error.
func highest[S ~[]T, T any](s S) int {
return len(s) - 1

View File

@ -105,6 +105,8 @@ func (z *ZoneGenData) Less(i, j int) bool {
return a.String() < b.String()
}
// LabelLess provides a "Less" function for two labels as needed for sorting. It
// sorts labels in prefix order, to make output pretty.
func LabelLess(a, b string) bool {
// Compare two zone labels for the purpose of sorting the RRs in a Zone.

View File

@ -208,9 +208,8 @@ func (c *hednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models
// Fallback to legacy mode if diff2 is not enabled, remove when diff1 is deprecated.
if !diff2.EnableDiff2 {
return c.getDiff1DomainCorrections(dc, zoneID, prunedRecords)
} else {
return c.getDiff2DomainCorrections(dc, zoneID, prunedRecords)
}
return c.getDiff2DomainCorrections(dc, zoneID, prunedRecords)
}
func (c *hednsProvider) getDiff1DomainCorrections(dc *models.DomainConfig, zoneID uint64, records models.Records) ([]*models.Correction, error) {