ferrous_forge/commands/mod.rs
1//! Command implementations for Ferrous Forge
2
3use clap::Subcommand;
4
5/// Available commands for Ferrous Forge
6#[derive(Subcommand)]
7pub enum Commands {
8 /// Initialize Ferrous Forge system-wide
9 Init {
10 /// Force initialization even if already configured
11 #[arg(short, long)]
12 force: bool,
13 },
14 /// Show status of Ferrous Forge installation and configuration
15 Status,
16 /// Update Ferrous Forge to the latest version
17 Update {
18 /// Update channel to use (stable, beta, nightly)
19 #[arg(short, long, default_value = "stable")]
20 channel: String,
21 /// Only update rules, not the binary
22 #[arg(short, long)]
23 rules_only: bool,
24 /// Show what would be updated without actually updating
25 #[arg(short, long)]
26 dry_run: bool,
27 },
28 /// Manage configuration settings
29 Config {
30 /// Set a configuration value (key=value)
31 #[arg(short, long)]
32 set: Option<String>,
33 /// Get a configuration value
34 #[arg(short, long)]
35 get: Option<String>,
36 /// List all configuration values
37 #[arg(short, long)]
38 list: bool,
39 /// Reset configuration to defaults
40 #[arg(short, long)]
41 reset: bool,
42 },
43 /// Validate a Rust project against standards
44 Validate {
45 /// Path to the project to validate (defaults to current directory)
46 path: Option<std::path::PathBuf>,
47 },
48 /// Rollback to a previous version
49 Rollback {
50 /// Version to rollback to
51 version: String,
52 },
53 /// Uninstall Ferrous Forge from the system
54 Uninstall {
55 /// Confirm uninstallation without prompting
56 #[arg(short, long)]
57 confirm: bool,
58 },
59 /// Rust version management
60 Rust {
61 #[command(subcommand)]
62 command: RustCommand,
63 },
64 /// Edition management
65 Edition {
66 #[command(subcommand)]
67 command: EditionCommand,
68 },
69}
70
71/// Rust version management subcommands
72#[derive(Subcommand)]
73pub enum RustCommand {
74 /// Check current Rust version and available updates
75 Check {
76 /// Show verbose output
77 #[arg(short, long)]
78 verbose: bool,
79 },
80 /// Get update recommendations
81 Recommend {
82 /// Only consider stable releases
83 #[arg(short, long)]
84 stable_only: bool,
85 },
86 /// List recent Rust releases
87 List {
88 /// Number of releases to show
89 #[arg(short, long, default_value = "10")]
90 count: usize,
91 },
92}
93
94/// Edition management subcommands
95#[derive(Subcommand)]
96pub enum EditionCommand {
97 /// Check edition compliance
98 Check {
99 /// Project path
100 #[arg(default_value = ".")]
101 path: std::path::PathBuf,
102 },
103 /// Migrate to a new edition
104 Migrate {
105 /// Target edition (2018, 2021, 2024)
106 #[arg(default_value = "2024")]
107 edition: String,
108 /// Skip backup creation
109 #[arg(long)]
110 no_backup: bool,
111 /// Run tests after migration
112 #[arg(long)]
113 test: bool,
114 /// Apply edition idioms
115 #[arg(long)]
116 idioms: bool,
117 },
118 /// Analyze edition compatibility
119 Analyze {
120 /// Project path
121 #[arg(default_value = ".")]
122 path: std::path::PathBuf,
123 /// Target edition
124 #[arg(default_value = "2024")]
125 edition: String,
126 },
127}
128
129pub mod config;
130pub mod edition;
131pub mod init;
132pub mod rollback;
133pub mod rust;
134pub mod status;
135pub mod uninstall;
136pub mod update;
137pub mod validate;