cleanup: remove conflicting example file
commit 7cd9a20593f9494664d7b5ff83dbf65e0be51c1f · parent 402420e892
· browse this tree
Ximainth, 2025-10-19 10:21:05 UTC
Co-Authored-By: sketch <hello@sketch.dev> Change-ID: sf5f1ffcc07ef5674k
diff --git a/v2/example_basic.go b/v2/example_basic.go deleted file mode 100644 index 10f16fb..0000000 --- a/v2/example_basic.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "fmt" - - testmark "github.com/warpfork/go-testmark/v2" -) - -func main() { - // Example of the clean v2 API - data := `# My Configuration - -[testmark]:# (database/host) -` + "```\nlocalhost\n```" + ` - -[testmark]:# (database/port) -` + "```\n5432\n```" + ` - -[testmark]:# (api/endpoint) -` + "```\nhttps://api.example.com\n```" + ` -` - - // Parse document - directory indexing happens automatically! - doc, err := testmark.Parse([]byte(data)) - if err != nil { - panic(err) - } - - fmt.Printf("Loaded %d hunks\n", doc.Count()) - - // Access hunks by name - host := doc.HunkByName("database/host") - fmt.Printf("Database host: %s", host.String()) - - // Navigate like a filesystem - dbConfig := doc.Root().Child("database") - for iter := dbConfig.Children(); iter.Next(); { - entry := iter.Entry() - fmt.Printf("DB %s: %s", entry.Name(), entry.Hunk().String()) - } - - // Iterate over all hunks - fmt.Println("All configuration:") - for iter := doc.Hunks(); iter.Next(); { - hunk := iter.Hunk() - fmt.Printf(" %s: %s", hunk.Name(), hunk.String()) - } - - // Patch a value - newPort := testmark.NewHunkString("database/port", "", "5433\n") - updated := doc.Patch(newPort) - - fmt.Println("\nAfter updating port:") - fmt.Printf("Original port: %s", doc.HunkByName("database/port").String()) - fmt.Printf("Updated port: %s", updated.HunkByName("database/port").String()) -}