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 /// Rust version management subcommand
62 #[command(subcommand)]
63 command: RustCommand,
64 },
65 /// Edition management
66 Edition {
67 /// Edition management subcommand
68 #[command(subcommand)]
69 command: EditionCommand,
70 },
71}
72
73/// Rust version management subcommands
74#[derive(Subcommand)]
75pub enum RustCommand {
76 /// Check current Rust version and available updates
77 Check {
78 /// Show verbose output
79 #[arg(short, long)]
80 verbose: bool,
81 },
82 /// Get update recommendations
83 Recommend {
84 /// Only consider stable releases
85 #[arg(short, long)]
86 stable_only: bool,
87 },
88 /// List recent Rust releases
89 List {
90 /// Number of releases to show
91 #[arg(short, long, default_value = "10")]
92 count: usize,
93 },
94}
95
96/// Edition management subcommands
97#[derive(Subcommand)]
98pub enum EditionCommand {
99 /// Check edition compliance
100 Check {
101 /// Project path
102 #[arg(default_value = ".")]
103 path: std::path::PathBuf,
104 },
105 /// Migrate to a new edition
106 Migrate {
107 /// Target edition (2018, 2021, 2024)
108 #[arg(default_value = "2024")]
109 edition: String,
110 /// Skip backup creation
111 #[arg(long)]
112 no_backup: bool,
113 /// Run tests after migration
114 #[arg(long)]
115 test: bool,
116 /// Apply edition idioms
117 #[arg(long)]
118 idioms: bool,
119 },
120 /// Analyze edition compatibility
121 Analyze {
122 /// Project path
123 #[arg(default_value = ".")]
124 path: std::path::PathBuf,
125 /// Target edition
126 #[arg(default_value = "2024")]
127 edition: String,
128 },
129}
130
131pub mod config;
132pub mod edition;
133pub mod init;
134pub mod rollback;
135pub mod rust;
136pub mod status;
137pub mod uninstall;
138pub mod update;
139pub mod validate;