1use super::{ProjectType, TraversalDirection};
2use std::path::Path;
3
4pub struct NodeProject {}
5impl ProjectType for NodeProject {
6 fn direction() -> TraversalDirection {
7 TraversalDirection::Backwards
8 }
9 fn condition(path: &Path) -> bool {
10 let package = path.join("package.json");
11 package.is_file()
12 }
13}
14
15pub struct PythonProject {}
16impl ProjectType for PythonProject {
17 fn direction() -> TraversalDirection {
18 TraversalDirection::Backwards
19 }
20 fn condition(path: &Path) -> bool {
21 let toml = path.join("pyproject.toml");
22 toml.is_file()
23 }
24}
25
26pub struct RustProject {}
27impl ProjectType for RustProject {
28 fn direction() -> TraversalDirection {
29 TraversalDirection::Backwards
30 }
31 fn condition(path: &Path) -> bool {
32 let toml = path.join("Cargo.toml"); toml.is_file()
34 }
35}
36
37pub struct NixProject {}
38impl ProjectType for NixProject {
39 fn direction() -> TraversalDirection {
40 TraversalDirection::Backwards
41 }
42 fn condition(path: &Path) -> bool {
43 let flake = path.join("flake.nix"); flake.is_file()
45 }
46}
47
48pub struct GitProject {}
49impl ProjectType for GitProject {
50 fn direction() -> TraversalDirection {
51 TraversalDirection::Backwards
52 }
53 fn condition(path: &Path) -> bool {
54 let git_dir = path.join(".git");
55 git_dir.is_dir()
56 }
57}
58
59pub struct DockerProject {}
60impl ProjectType for DockerProject {
61 fn direction() -> TraversalDirection {
62 TraversalDirection::Forward
63 }
64 fn condition(path: &Path) -> bool {
65 let dockerfile = path.join("Dockerfile"); dockerfile.is_file()
67 }
68}