diff --git a/src/cli/cmd/init/handlers/rust.rs b/src/cli/cmd/init/handlers/rust.rs index 0878ef5e..0a0d14ae 100644 --- a/src/cli/cmd/init/handlers/rust.rs +++ b/src/cli/cmd/init/handlers/rust.rs @@ -2,9 +2,7 @@ use crate::cli::cmd::init::prompt::Prompt; use super::{Flake, Handler, Input, Project}; -const CARGO_TOOLS: &[&str] = &[ - "audit", "bloat", "cross", "edit", "outdated", "udeps", "watch", -]; +const CARGO_TOOLS: &[&str] = &["bloat", "edit", "outdated", "udeps", "watch"]; pub(crate) struct Rust; @@ -57,6 +55,18 @@ impl Handler for Rust { .env_vars .insert(String::from("RUST_BACKTRACE"), String::from("1")); } + + if project.has_file("Cross.toml") && Prompt::bool("This project appears to use cross-rs. Would you like to add the cargo-cross tool to your environment?") { + flake.dev_shell_packages.push(String::from("cargo-cross")); + } + + if project.has_file("deny.toml") && Prompt::bool("This project appears to use cargo-deny. Would you like to add it to your environment?") { + flake.dev_shell_packages.push(String::from("cargo-deny")); + } + + if project.has_file("audit.toml") && Prompt::bool("This project appears to use cargo-audit. Would you like to add it to your environment?") { + flake.dev_shell_packages.push(String::from("cargo-audit")); + } } } } diff --git a/src/cli/cmd/init/handlers/tools.rs b/src/cli/cmd/init/handlers/tools.rs index d126f81b..10610819 100644 --- a/src/cli/cmd/init/handlers/tools.rs +++ b/src/cli/cmd/init/handlers/tools.rs @@ -16,10 +16,83 @@ impl Handler for Tools { flake.dev_shell_packages.push(attr); } + // Build tools if project.has_one_of(&["WORKSPACE", ".bazelrc", ".bazelversion", "BUILD.bazel"]) && Prompt::for_tool("Bazel") { flake.dev_shell_packages.push(String::from("bazel")); } + + // Deployment + if project.has_file("site.yml") && Prompt::for_tool("Ansible") { + flake.dev_shell_packages.push(String::from("ansible")); + } + + if project.has_file("Pulumi.yaml") && Prompt::for_tool("Pulumi") { + flake.dev_shell_packages.push(String::from("pulumi")); + } + + // SaaS deployment tools + if project.has_file("vercel.json") && Prompt::bool("This project appears to deploy to Vercel. Would you like to add the Vercel CLI to your environment?") { + flake.dev_shell_packages.push(String::from("nodePackages.vercel")); + } + + if project.has_file("netlify.toml") && Prompt::bool("This project appears to deploy to Netlify. Would you like to add the Netlify CLI to your environment?") { + flake.dev_shell_packages.push(String::from("netlify-cli")); + } + + if project.has_file("fly.toml") && Prompt::bool("This project appears to deploy to Fly. Would you like to add the Fly CLI to your environment?") { + flake.dev_shell_packages.push(String::from("flyctl")); + } + + // Kubernetes tools + if project.has_file("Tiltfile") && Prompt::for_tool("Tilt") { + flake.dev_shell_packages.push(String::from("tilt")); + } + + // Schema-driven development + if project.has_one_of(&["buf.yaml", "buf.lock", "buf.gen.yaml", "buf.work.yaml"]) + && Prompt::for_tool("Buf") + { + flake.dev_shell_packages.push(String::from("buf")); + } + + // Checkers + if project.has_file(".shellcheckrc") && Prompt::for_tool("ShellCheck") { + flake.dev_shell_packages.push(String::from("shellcheck")); + } + + // Virtual machines + if project.has_file("Vagrantfile") && Prompt::for_tool("Vagrant") { + flake.dev_shell_packages.push(String::from("vagrant")); + } + + // SQL tools + if project.has_file("sqlx-data.json") && Prompt::bool("This project appears to use sqlx for Rust. Would you like to add the sqlx CLI to your environment?") { + flake.dev_shell_packages.push(String::from("sqlx-cli")); + } + + // Static site generation + if project.has_one_of(&["hugo.json", "hugo.toml", "hugo.yaml"]) && Prompt::for_tool("Hugo") + { + flake.dev_shell_packages.push(String::from("hugo")); + } + + if project.has_one_of(&["_config.toml", "_config.toml"]) && Prompt::for_tool("Jekyll") { + flake + .dev_shell_packages + .push(String::from("rubyPackages.jekyll")); + } + + if project.has_one_of(&["mkdocs.yaml", "mkdocs.yml"]) && Prompt::for_tool("MkDocs") { + flake.dev_shell_packages.push(String::from("mkdocs")); + } + + // Git + if project.has_file(".pre-commit-config.yaml") && Prompt::for_tool("pre-commit-hooks") { + flake + .dev_shell_packages + .push(String::from("python311Packages.pre-commit-hooks")); + } } }