Simplify admin publishing pipeline
This commit is contained in:
parent
13e7e4026d
commit
9186801c7f
37 changed files with 750 additions and 3367 deletions
|
|
@ -1,33 +0,0 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue