1use crate::{
2 templates::{BaseTemplate, Template, Templates, WorktreeData},
3 thread::Prompt,
4};
5use anyhow::Result;
6use gpui::{App, Entity};
7use project::Project;
8
9struct BasePrompt {
10 project: Entity<Project>,
11}
12
13impl Prompt for BasePrompt {
14 fn render(&self, templates: &Templates, cx: &App) -> Result<String> {
15 BaseTemplate {
16 os: std::env::consts::OS.to_string(),
17 shell: util::get_system_shell(),
18 worktrees: self
19 .project
20 .read(cx)
21 .worktrees(cx)
22 .map(|worktree| WorktreeData {
23 root_name: worktree.read(cx).root_name().to_string(),
24 })
25 .collect(),
26 }
27 .render(templates)
28 }
29}