1pub mod analyzer;
2pub mod cli;
3pub mod common;
4pub mod config;
5pub mod error;
6pub mod generator;
7pub mod handlers;
8pub mod telemetry; pub use analyzer::{ProjectAnalysis, analyze_project};
12use cli::Commands;
13pub use error::{IaCGeneratorError, Result};
14pub use generator::{generate_compose, generate_dockerfile, generate_terraform};
15pub use handlers::*;
16pub use telemetry::{TelemetryClient, TelemetryConfig, UserId}; pub const VERSION: &str = env!("CARGO_PKG_VERSION");
20
21pub async fn run_command(command: Commands) -> Result<()> {
22 match command {
23 Commands::Analyze {
24 path,
25 json,
26 detailed,
27 display,
28 only,
29 color_scheme,
30 } => {
31 match handlers::handle_analyze(path, json, detailed, display, only, color_scheme) {
32 Ok(_output) => Ok(()), Err(e) => Err(e),
34 }
35 }
36 Commands::Generate {
37 path,
38 output,
39 dockerfile,
40 compose,
41 terraform,
42 all,
43 dry_run,
44 force,
45 } => handlers::handle_generate(
46 path, output, dockerfile, compose, terraform, all, dry_run, force,
47 ),
48 Commands::Validate { path, types, fix } => handlers::handle_validate(path, types, fix),
49 Commands::Support {
50 languages,
51 frameworks,
52 detailed,
53 } => handlers::handle_support(languages, frameworks, detailed),
54 Commands::Dependencies {
55 path,
56 licenses,
57 vulnerabilities,
58 prod_only,
59 dev_only,
60 format,
61 } => handlers::handle_dependencies(
62 path,
63 licenses,
64 vulnerabilities,
65 prod_only,
66 dev_only,
67 format,
68 )
69 .await
70 .map(|_| ()),
71 Commands::Vulnerabilities {
72 path,
73 severity,
74 format,
75 output,
76 } => handlers::handle_vulnerabilities(path, severity, format, output).await,
77 Commands::Security {
78 path,
79 mode,
80 include_low,
81 no_secrets,
82 no_code_patterns,
83 no_infrastructure,
84 no_compliance,
85 frameworks,
86 format,
87 output,
88 fail_on_findings,
89 } => {
90 handlers::handle_security(
91 path,
92 mode,
93 include_low,
94 no_secrets,
95 no_code_patterns,
96 no_infrastructure,
97 no_compliance,
98 frameworks,
99 format,
100 output,
101 fail_on_findings,
102 )
103 .map(|_| ()) }
105 Commands::Tools { command } => handlers::handle_tools(command).await,
106 }
107}