Skip to content

Ruben-Jim/BlogPostTerminal

Repository files navigation

Terminal-based Blog Manager

A beautiful, feature-rich terminal-based blog management system built with Python and Rich.

Features

  • Beautiful GUI Interface - Rich terminal UI with colors, tables, and interactive menus
  • 📝 Create & Edit Posts - Easy post creation with tags and metadata
  • 🔍 Search & Filter - Search posts by title, content, or tags
  • 📊 Statistics Dashboard - View blog analytics and insights
  • 📤 Export Options - Export posts as Markdown, HTML, or JSON
  • 🏷️ Tag Management - Organize posts with tags
  • 📱 Cross-platform - Works on Windows, macOS, and Linux

Quick Start

Prerequisites

  • Python 3.7+ installed
  • Windows PowerShell or Command Prompt

Installation

  1. Clone or download this repository
  2. Install dependencies (automatic on first run):
    py -m pip install click rich

Usage

Windows (Recommended)

Use the batch file for easy access:

# Launch GUI interface
.\blog.bat gui

# Create a new post
.\blog.bat create

# List all posts
.\blog.bat list

# View a specific post
.\blog.bat view [post-id]

# Search posts
.\blog.bat search [term]

# Show statistics
.\blog.bat stats

# Export posts
.\blog.bat export --format markdown

Direct Python Commands

# Launch GUI interface
py main.py gui

# Create a new post
py main.py create --title "My Post" --content "Content here" --tags "tag1,tag2"

# List all posts
py main.py list

# View a specific post
py main.py view [post-id]

# Search posts
py main.py search [term]

# Show statistics
py main.py stats

# Export posts
py main.py export --format markdown

Commands Reference

Command Description
gui Launch interactive GUI interface
create Create a new blog post
list List all blog posts
view [post-id] View a specific blog post
search [term] Search blog posts
edit [post-id] Edit an existing blog post
delete [post-id] Delete a blog post
stats Show blog statistics
export Export all posts to files

File Structure

BlogPostTerminal/
├── main.py              # Main CLI application
├── blog_manager.py      # Core business logic
├── models.py            # Data models
├── storage.py           # JSON storage layer
├── utils.py             # Utility functions
├── blog.bat             # Windows batch wrapper
├── blog.sh              # Linux/macOS shell wrapper
├── blog_data/           # Blog posts storage
│   ├── index.json       # Posts index
│   └── posts/           # Individual post files
├── blog_export/         # Exported posts
└── templates/           # Export templates

Features in Detail

🎨 Rich GUI Interface

  • Beautiful terminal-based interface with colors and formatting
  • Interactive menu system
  • Real-time post previews
  • Sidebar with post overview

📝 Post Management

  • Create posts with title, content, author, and tags
  • Edit existing posts
  • Delete posts with confirmation
  • Automatic post ID generation

🔍 Search & Filter

  • Search by title, content, or tags
  • Filter posts by author or tags
  • Real-time search results

📊 Statistics

  • Total posts count
  • Most active authors
  • Popular tags
  • Average post length
  • Reading time estimates

📤 Export Options

  • Markdown: Perfect for static site generators
  • HTML: Ready-to-view web pages
  • JSON: For API integration

Data Storage

Posts are stored as JSON files in the blog_data/ directory:

  • blog_data/index.json - Posts index with metadata
  • blog_data/posts/ - Individual post files

Troubleshooting

Windows Issues

  1. Python not found: Make sure Python is installed and py command works
  2. Dependencies missing: Run py -m pip install click rich
  3. Editor not available: Use --content option to provide content directly

Common Commands

# Check Python version
py --version

# Install dependencies manually
py -m pip install click rich

# Run with verbose output
py main.py --help

Examples

Create a Blog Post

.\blog.bat create
# Follow the prompts to enter title, content, tags, and author

Search for Posts

.\blog.bat search python
# Find all posts containing "python" in title, content, or tags

Export to Markdown

.\blog.bat export --format markdown --output-dir ./my-blog
# Export all posts as markdown files

Contributing

Feel free to submit issues and enhancement requests!

License

This project is open source and available under the MIT License.