#!/usr/bin/env python3 """ Generate a presenterm presentation template. Usage: python new-presentation.py --title "My Talk" --author "Me" --theme dark --template minimal --output slides.md python new-presentation.py --title "My Talk" --author "Me" --theme catppuccin-mocha --template tech-talk --output slides.md python new-presentation.py --title "X" --author "Y" --output - # write to stdout """ import argparse import sys from pathlib import Path TEMPLATES = { "minimal": """--- title: "{title}" author: "{author}" theme: name: {theme} --- First Slide === Your content here. Second Slide === More content. """, "tech-talk": """--- title: "{title}" author: "{author}" theme: name: {theme} --- Why This Matters === [Establish motivation in 2-3 sentences] The Problem === [Describe the pain point] * Point 1 * Point 2 * Point 3 The Solution === [Your approach] Demo === [Live code or screenshots] Summary === [Key takeaways] **Questions?** """, } VALID_THEMES = [ "catppuccin-latte", "catppuccin-frappe", "catppuccin-macchiato", "catppuccin-mocha", "dark", "gruvbox-dark", "light", "terminal-dark", "terminal-light", "tokyonight-day", "tokyonight-moon", "tokyonight-night", "tokyonight-storm", ] def main(): parser = argparse.ArgumentParser( description="Generate a presenterm presentation template", formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: python new-presentation.py --title "My Talk" --author "Me" --output slides.md python new-presentation.py --title "My Talk" --author "Me" --theme catppuccin-mocha --template tech-talk --output slides.md python new-presentation.py --title "My Talk" --author "Me" --output - # stdout Available themes: catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha dark, light, gruvbox-dark terminal-dark, terminal-light tokyonight-day, tokyonight-moon, tokyonight-night, tokyonight-storm Available templates: minimal - Bare starter (2 placeholder slides) tech-talk - Narrative arc structure (Why → Problem → Solution → Demo → Summary) """, ) parser.add_argument( "--title", help="Presentation title", ) parser.add_argument( "--author", help="Author name", ) parser.add_argument( "--theme", default="dark", help=f"Theme name (default: dark). Use --list-themes to see options.", ) parser.add_argument( "--template", choices=list(TEMPLATES.keys()), default="minimal", help="Template to use (default: minimal)", ) parser.add_argument( "--output", default="-", help="Output file path. Use - for stdout (default: -)", ) parser.add_argument( "--list-themes", action="store_true", help="List available themes and exit", ) args = parser.parse_args() if args.list_themes: print("Available themes:") for theme in VALID_THEMES: print(f" {theme}") return 0 if not args.title or not args.author: print( "Error: --title and --author are required", file=sys.stderr, ) return 1 if args.theme not in VALID_THEMES: print( f"Error: Unknown theme '{args.theme}'", file=sys.stderr, ) print("Use --list-themes to see available themes.", file=sys.stderr) return 1 content = TEMPLATES[args.template].format( title=args.title, author=args.author, theme=args.theme, ) if args.output == "-": print(content) else: output_path = Path(args.output) output_path.parent.mkdir(parents=True, exist_ok=True) output_path.write_text(content) print(f"Created: {args.output}") return 0 if __name__ == "__main__": sys.exit(main())