Add Go/Postgres admin APIs, Angular admin UI, manual build flow, asset uploads, markdown import/export, configurable slug generation, and the Yar reading theme. Exclude local docs and generated development artifacts from version control.
33 lines
890 B
Go
33 lines
890 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"osaet/backend/internal/postimport"
|
|
)
|
|
|
|
func main() {
|
|
fs := flag.NewFlagSet("import-articles", flag.ExitOnError)
|
|
file := fs.String("file", "articles.csv", "CSV file path")
|
|
overwrite := fs.Bool("overwrite", false, "overwrite existing markdown files")
|
|
postsDir := fs.String("posts-dir", "content/posts", "posts output directory relative to project root")
|
|
if err := fs.Parse(os.Args[1:]); err != nil {
|
|
fmt.Fprintln(os.Stderr, "error:", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
result, err := postimport.Import(postimport.Options{
|
|
CSVPath: *file,
|
|
PostsDir: *postsDir,
|
|
Overwrite: *overwrite,
|
|
WorkingDir: "",
|
|
})
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "error:", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Printf("imported %d post(s), skipped %d existing file(s), skipped %d non-post row(s)\n", result.Imported, result.SkippedExisting, result.SkippedNonPost)
|
|
}
|