aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-09-17 19:14:19 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-09-17 19:14:19 +0200
commitcfd01ade02924d0e81004f744adc3f18ac77d5a7 (patch)
tree04dc176fbf08764eb645acb359ecedecc7ec9c36
parent9b4b5c2fe3aa1042d4bab8cef94b154ae85cad24 (diff)
downloadapkdoc-cfd01ade02924d0e81004f744adc3f18ac77d5a7.tar.gz
apkdoc-cfd01ade02924d0e81004f744adc3f18ac77d5a7.tar.bz2
apkdoc-cfd01ade02924d0e81004f744adc3f18ac77d5a7.zip
feat: Add check rule
-rw-r--r--.gitignore2
-rw-r--r--Makefile7
-rw-r--r--main.go14
3 files changed, 16 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index f331ccd..7712b56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
bin/
vendor/
+
+index.md
diff --git a/Makefile b/Makefile
index e5bf8e9..6fafba4 100644
--- a/Makefile
+++ b/Makefile
@@ -20,3 +20,10 @@ install:
compress:
upx --best --ultra-brute $(OUT)
+
+check: build
+ $(OUT) \
+ -f example.md \
+ -t text \
+ -u https://alpine.mirror.wearetriple.com/v3.18/main/x86_64/APKINDEX.tar.gz \
+ -o index.txt
diff --git a/main.go b/main.go
index 3f3f40c..2231f97 100644
--- a/main.go
+++ b/main.go
@@ -18,8 +18,8 @@ func main() {
var (
url = flag.StringP("url", "u", "", "Url to the APKINDEX.tar.gz")
output = flag.StringP("output", "o", "index.md", "Output path")
- templateType = flag.StringP("template-type", "p", "text", "Template system to be used, options: html, text")
- templateFile = flag.StringP("template-file", "t", "text", "Template file to be used")
+ templateType = flag.StringP("template-type", "t", "text", "Template system to be used, options: html, text")
+ templateFile = flag.StringP("template-file", "f", "text", "Template file to be used")
)
flag.Parse()
@@ -40,7 +40,6 @@ func run(
output string,
templateType string,
templateFile string,
-
) error {
tarStream, err := fechIndex(url)
@@ -68,10 +67,11 @@ func run(
}
}
- s := bufio.NewScanner(tr)
-
- entries := make([]*Entry, 0)
- lines := make([]string, 0)
+ var (
+ s = bufio.NewScanner(tr)
+ entries = make([]*Entry, 0)
+ lines = make([]string, 0)
+ )
for s.Scan() {
l := s.Text()