refactor: consolidate CLI command definitions to lib.rs

- Move all CLI command enums (ChannelCommands, SkillCommands, CronCommands, IntegrationCommands, MigrateCommands, ServiceCommands) to lib.rs
- Add clap derives for use in main.rs CLI parsing
- Update all modules to use crate:: prefix instead of super:: for command types
- Add mod util; to main.rs for binary compilation
- Export Config type from lib.rs for main.rs

This refactoring eliminates code duplication between library modules and binary, centralizing all CLI command definitions in one place.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
argenis de la rosa 2026-02-15 06:52:33 -05:00
parent 9aaa5bfef1
commit 085b57aa30
7 changed files with 131 additions and 18 deletions

View file

@ -19,9 +19,9 @@ pub struct CronJob {
}
#[allow(clippy::needless_pass_by_value)]
pub fn handle_command(command: super::CronCommands, config: &Config) -> Result<()> {
pub fn handle_command(command: crate::CronCommands, config: &Config) -> Result<()> {
match command {
super::CronCommands::List => {
crate::CronCommands::List => {
let jobs = list_jobs(config)?;
if jobs.is_empty() {
println!("No scheduled tasks yet.");
@ -48,7 +48,7 @@ pub fn handle_command(command: super::CronCommands, config: &Config) -> Result<(
}
Ok(())
}
super::CronCommands::Add {
crate::CronCommands::Add {
expression,
command,
} => {
@ -59,7 +59,7 @@ pub fn handle_command(command: super::CronCommands, config: &Config) -> Result<(
println!(" Cmd : {}", job.command);
Ok(())
}
super::CronCommands::Remove { id } => remove_job(config, &id),
crate::CronCommands::Remove { id } => remove_job(config, &id),
}
}