#include "dropshell.hpp"
#include "templates.hpp"
#include <iostream>
#include <iomanip>

void dropshell::list_templates() {
    template_manager tm;
    std::vector<template_info> templates;
    
    if (!tm.get_templates(templates)) {
        std::cerr << "Error: Failed to get templates" << std::endl;
        return;
    }
    
    if (templates.empty()) {
        std::cout << "No templates found." << std::endl;
        return;
    }
    
    std::cout << "Available templates:" << std::endl;
    std::cout << std::left << std::setw(20) << "Name" << "Path" << std::endl;
    std::cout << std::string(60, '-') << std::endl;
    
    for (const auto& t : templates) {
        std::cout << std::left << std::setw(20) << t.name << t.path << std::endl;
    }
}