You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
naza/demo/add_blog_license/main.go

30 lines
552 B
Go

package main
import (
"bytes"
"flag"
"github.com/q191201771/naza/pkg/filebatch"
"github.com/q191201771/naza/pkg/nazalog"
"os"
)
func main() {
dir := parseFlag()
err := filebatch.Walk(dir, true, ".md", func(path string, info os.FileInfo, content []byte) []byte {
lines := bytes.Split(content, []byte{'\n'})
nazalog.Debug(path, len(lines))
return nil
})
nazalog.FatalIfErrorNotNil(err)
}
func parseFlag() string {
dir := flag.String("d", "", "dir of posts")
flag.Parse()
if *dir == "" {
flag.Usage()
os.Exit(1)
}
return *dir
}