From 1f952f0d59e7b6ae130f45f85ef9f4d077abbe25 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Thu, 11 Jan 2018 12:38:46 +0000 Subject: initial commit --- d1pkgweb-query.go | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 d1pkgweb-query.go diff --git a/d1pkgweb-query.go b/d1pkgweb-query.go new file mode 100644 index 0000000..a6514b5 --- /dev/null +++ b/d1pkgweb-query.go @@ -0,0 +1,139 @@ +package main + +import ( + "bufio" + "fmt" + "html/template" + "net/http" + "net/http/cgi" + "os" + "os/exec" + "strings" + "time" +) + +type Result struct { + Name string + Version string + URL string +} + +type ResultPage struct { + Query string + NumResults int + Time string + Results []Result +} + +var resTempl = ` + +Results + + +
+Search Devuan Packages for: + +
+ + +
{{.NumResults}} results for {{.Query}} (in {{.Time}})
+ +