Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/mark2note/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Flags:
--author <name> one-off cover author input (blank falls back to deck.author) (default from deck.author)
--prompt-extra <text> extra natural-language guidance for deck generation
--asset-manifest <file> poster asset manifest for list/article cover cards
--card-manifest <file> card article manifest json input path; skips AI deck generation
--auto-posters automatically search poster candidates and hydrate cover cards
--poster-sources <csv> poster providers for --auto-posters (default: bilibili,bangumi,anilist,mydramalist)
--publish-xhs publish generated PNG files to Xiaohongshu after render
Expand Down Expand Up @@ -262,6 +263,7 @@ func parseOptions(args []string) (Options, error) {
fs.StringVar(&opts.Author, "author", opts.Author, "one-off cover author input (blank falls back to deck.author)")
fs.StringVar(&opts.PromptExtra, "prompt-extra", opts.PromptExtra, "extra natural-language guidance for deck generation")
fs.StringVar(&opts.AssetManifestPath, "asset-manifest", opts.AssetManifestPath, "poster asset manifest for list/article cover cards")
fs.StringVar(&opts.CardManifestPath, "card-manifest", opts.CardManifestPath, "card article manifest json input path")
fs.BoolVar(&opts.AutoPosters, "auto-posters", opts.AutoPosters, "automatically search poster candidates and hydrate cover cards")
fs.StringVar(&posterSources, "poster-sources", posterSources, "comma-separated poster providers for --auto-posters")
fs.BoolVar(&opts.PublishXHS, "publish-xhs", opts.PublishXHS, "publish generated PNG files to Xiaohongshu after render")
Expand Down Expand Up @@ -308,6 +310,9 @@ func parseOptions(args []string) (Options, error) {
if hasFromDeck && strings.TrimSpace(opts.PromptExtra) != "" {
return Options{}, fmt.Errorf("--prompt-extra can only be used with --input\n\n%s", usageText())
}
if hasFromDeck && strings.TrimSpace(opts.CardManifestPath) != "" {
return Options{}, fmt.Errorf("--card-manifest can only be used with --input\n\n%s", usageText())
}
if hasFromDeck && opts.PublishXHS {
return Options{}, fmt.Errorf("--publish-xhs can only be used with --input\n\n%s", usageText())
}
Expand Down
10 changes: 10 additions & 0 deletions cmd/mark2note/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ func TestParseOptionsParsesAssetManifest(t *testing.T) {
}
}

func TestParseOptionsParsesCardManifest(t *testing.T) {
opts, err := parseOptions([]string{"--input", "article.md", "--card-manifest", "manifest.json"})
if err != nil {
t.Fatalf("parseOptions() error = %v", err)
}
if opts.CardManifestPath != "manifest.json" {
t.Fatalf("CardManifestPath = %q, want manifest.json", opts.CardManifestPath)
}
}

func TestParseOptionsParsesAutoPostersAndSources(t *testing.T) {
opts, err := parseOptions([]string{"--input", "article.md", "--auto-posters", "--poster-sources", "anilist, mydramalist"})
if err != nil {
Expand Down
Loading