♻️ refactor(cli): rename command to sub_command for clarity
- rename `command` field to `sub_command` in `Cli` and `ConfigCli` structs
- rename `Commands` enum to `SubCmds` to reflect its role as subcommand
- update references to the renamed fields and enum variants
- this improves code readability and avoids confusion with other command concepts
🐛 fix(config): correct method name for setting eol action
- rename `set_command` to `set_action` in `EolRule` struct
- update references in `config.rs` to use the correct method name
- this fixes a bug where the eol action was not being set correctly
This commit is contained in:
committed by
Jeremiah Russell
parent
e80c7e3273
commit
40ea9e52f4
@@ -10,7 +10,7 @@ use label_cli::LabelCli;
|
||||
use rules_cli::RulesCli;
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
enum Commands {
|
||||
enum SubCmds {
|
||||
/// Configure end-of-life rules
|
||||
#[clap(name = "rules")]
|
||||
Rules(RulesCli),
|
||||
@@ -27,15 +27,15 @@ pub struct ConfigCli {
|
||||
#[clap(flatten)]
|
||||
logging: clap_verbosity_flag::Verbosity,
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
sub_command: SubCmds,
|
||||
}
|
||||
|
||||
impl ConfigCli {
|
||||
pub fn run(&self, config: Config) -> Result<()> {
|
||||
match &self.command {
|
||||
Commands::Rules(rules_cli) => rules_cli.run(config),
|
||||
Commands::Label(label_cli) => label_cli.run(config),
|
||||
Commands::Action(action_cli) => action_cli.run(config),
|
||||
match &self.sub_command {
|
||||
SubCmds::Rules(rules_cli) => rules_cli.run(config),
|
||||
SubCmds::Label(label_cli) => label_cli.run(config),
|
||||
SubCmds::Action(action_cli) => action_cli.run(config),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user