Rename catalog-zone-gen to catz across codebase
Update binary name, usage strings, generated file headers, tests, and README. The generated BIND config header now includes the install path: go install go.askask.com/catz@latest
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
*~
|
||||
/catalog-zone-gen
|
||||
/catz
|
||||
|
||||
10
README.md
10
README.md
@@ -1,4 +1,4 @@
|
||||
# catalog-zone-gen
|
||||
# catz
|
||||
|
||||
Generate RFC 9432 DNS catalog zone files from a declarative input file.
|
||||
|
||||
@@ -10,19 +10,19 @@ serial bump, no file write).
|
||||
## Installation
|
||||
|
||||
```
|
||||
go install catalog-zone-gen@latest
|
||||
go install go.askask.com/catz@latest
|
||||
```
|
||||
|
||||
Or build from source:
|
||||
|
||||
```
|
||||
go build -o catalog-zone-gen .
|
||||
go build -o catz .
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
catalog-zone-gen [--config path] [--output-dir path] [--bind-conf path] <input-file>
|
||||
catz [--config path] [--output-dir path] [--bind-conf path] <input-file>
|
||||
```
|
||||
|
||||
**Flags:**
|
||||
@@ -180,7 +180,7 @@ master` with their `file` paths from the `file=` input property.
|
||||
**Example output:**
|
||||
|
||||
```
|
||||
# THIS FILE IS GENERATED BY catalog-zone-gen
|
||||
# THIS FILE IS GENERATED BY catz (go install go.askask.com/catz@latest)
|
||||
#=============================================
|
||||
#
|
||||
zone "askask.com" {
|
||||
|
||||
@@ -19,7 +19,7 @@ func generateBindConf(entries []ZoneEntry, cfg *Config) string {
|
||||
})
|
||||
|
||||
var b strings.Builder
|
||||
b.WriteString("# THIS FILE IS GENERATED BY catalog-zone-gen\n")
|
||||
b.WriteString("# THIS FILE IS GENERATED BY catz (go install go.askask.com/catz@latest)\n")
|
||||
b.WriteString("#=============================================\n")
|
||||
b.WriteString("#\n")
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestGenerateBindConf(t *testing.T) {
|
||||
got := generateBindConf(entries, emptyCfg)
|
||||
|
||||
// Header
|
||||
assertContains(t, got, "# THIS FILE IS GENERATED BY catalog-zone-gen")
|
||||
assertContains(t, got, "# THIS FILE IS GENERATED BY catz (go install go.askask.com/catz@latest)")
|
||||
assertContains(t, got, "#=============================================")
|
||||
|
||||
// Zones should be sorted alphabetically (askask.com before bitcard.org)
|
||||
@@ -145,7 +145,7 @@ func TestWriteBindConfSkipsCatalogOnlyZones(t *testing.T) {
|
||||
got := string(data)
|
||||
|
||||
// Should have header but no zone blocks
|
||||
assertContains(t, got, "# THIS FILE IS GENERATED BY catalog-zone-gen")
|
||||
assertContains(t, got, "# THIS FILE IS GENERATED BY catz (go install go.askask.com/catz@latest)")
|
||||
if strings.Contains(got, "example.com") {
|
||||
t.Error("zone without file= should not appear in BIND config")
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# catalog-zone-gen configuration
|
||||
# catz configuration
|
||||
#
|
||||
# Each catalog becomes an output zone file named <zone>.zone
|
||||
# Catalog names here are referenced in zones.txt
|
||||
|
||||
2
main.go
2
main.go
@@ -14,7 +14,7 @@ func main() {
|
||||
outputDir := flag.String("output-dir", "", "directory for output zone files (default: same as input file)")
|
||||
bindConf := flag.String("bind-conf", "", "path to write BIND domains.conf")
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: catalog-zone-gen [--config path] [--output-dir path] [--bind-conf path] <input-file>\n")
|
||||
fmt.Fprintf(os.Stderr, "Usage: catz [--config path] [--output-dir path] [--bind-conf path] <input-file>\n")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
flag.Parse()
|
||||
|
||||
16
main_test.go
16
main_test.go
@@ -229,7 +229,7 @@ soa:
|
||||
|
||||
func TestIntegrationCLI(t *testing.T) {
|
||||
// Build the binary
|
||||
binary := filepath.Join(t.TempDir(), "catalog-zone-gen")
|
||||
binary := filepath.Join(t.TempDir(), "catz")
|
||||
cmd := exec.Command("go", "build", "-o", binary, ".")
|
||||
cmd.Dir = projectDir(t)
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
@@ -255,7 +255,7 @@ soa:
|
||||
cmd = exec.Command(binary, "--config", filepath.Join(dir, "catz.yaml"), "--output-dir", dir, filepath.Join(dir, "zones.txt"))
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("catalog-zone-gen failed: %v\n%s", err, out)
|
||||
t.Fatalf("catz failed: %v\n%s", err, out)
|
||||
}
|
||||
|
||||
// Verify output file exists
|
||||
@@ -270,7 +270,7 @@ soa:
|
||||
}
|
||||
|
||||
func TestIntegrationCLIErrors(t *testing.T) {
|
||||
binary := filepath.Join(t.TempDir(), "catalog-zone-gen")
|
||||
binary := filepath.Join(t.TempDir(), "catz")
|
||||
cmd := exec.Command("go", "build", "-o", binary, ".")
|
||||
cmd.Dir = projectDir(t)
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
@@ -422,7 +422,7 @@ soa:
|
||||
}
|
||||
|
||||
func TestIntegrationCLIBindConf(t *testing.T) {
|
||||
binary := filepath.Join(t.TempDir(), "catalog-zone-gen")
|
||||
binary := filepath.Join(t.TempDir(), "catz")
|
||||
cmd := exec.Command("go", "build", "-o", binary, ".")
|
||||
cmd.Dir = projectDir(t)
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
@@ -455,12 +455,12 @@ zone.example.com catalog1, file=data/zones/example.com
|
||||
filepath.Join(dir, "zones.txt"))
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("catalog-zone-gen failed: %v\n%s", err, out)
|
||||
t.Fatalf("catz failed: %v\n%s", err, out)
|
||||
}
|
||||
|
||||
// Verify bind conf was written
|
||||
content := readTestFile(t, bindConfPath)
|
||||
assertContains(t, content, "# THIS FILE IS GENERATED BY catalog-zone-gen")
|
||||
assertContains(t, content, "# THIS FILE IS GENERATED BY catz")
|
||||
|
||||
// zone.example.com should come before zone.example.org (sorted)
|
||||
comIdx := strings.Index(content, "zone.example.com")
|
||||
@@ -483,7 +483,7 @@ zone.example.com catalog1, file=data/zones/example.com
|
||||
}
|
||||
|
||||
func TestIntegrationCLIBindConfCatalogOnlyZone(t *testing.T) {
|
||||
binary := filepath.Join(t.TempDir(), "catalog-zone-gen")
|
||||
binary := filepath.Join(t.TempDir(), "catz")
|
||||
cmd := exec.Command("go", "build", "-o", binary, ".")
|
||||
cmd.Dir = projectDir(t)
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
@@ -524,7 +524,7 @@ soa:
|
||||
t.Fatalf("failed to read domains.conf: %v", readErr)
|
||||
}
|
||||
got := string(data)
|
||||
assertContains(t, got, "# THIS FILE IS GENERATED BY catalog-zone-gen")
|
||||
assertContains(t, got, "# THIS FILE IS GENERATED BY catz")
|
||||
if strings.Contains(got, "zone.example.org") {
|
||||
t.Error("catalog-only zone without file= should not appear in domains.conf")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user