🐛 fix: allow init command to run without existing config file
- Move init command handling before config loading in CLI dispatcher - Prevents init from failing when no configuration exists yet - Fixes CircleCI test failures where init was trying to load ~/.cull-gmail/cull-gmail.toml - All integration tests now pass in CI environment
This commit is contained in:
committed by
Jeremiah Russell
parent
b33458cf3e
commit
5bcfc8fd29
@@ -290,6 +290,13 @@ async fn main() {
|
||||
/// - Subcommand execution
|
||||
/// - Rule processing operations
|
||||
async fn run(args: Cli) -> Result<()> {
|
||||
// Handle init command first, before trying to load config
|
||||
if let Some(SubCmds::Init(init_cli)) = args.sub_command {
|
||||
// Init commands don't need existing config since they set up the config
|
||||
return init_cli.run().await;
|
||||
}
|
||||
|
||||
// For all other commands, load config normally
|
||||
let (config, client_config) = get_config()?;
|
||||
|
||||
// Check for token restoration before client initialization
|
||||
@@ -304,9 +311,9 @@ async fn run(args: Cli) -> Result<()> {
|
||||
};
|
||||
|
||||
match sub_command {
|
||||
SubCmds::Init(init_cli) => {
|
||||
// Init commands don't need a Gmail client since they set up the config
|
||||
init_cli.run().await
|
||||
SubCmds::Init(_) => {
|
||||
// This should never be reached due to early return above
|
||||
unreachable!("Init command should have been handled earlier");
|
||||
}
|
||||
SubCmds::Message(messages_cli) => messages_cli.run(&mut client).await,
|
||||
SubCmds::Labels(labels_cli) => labels_cli.run(client).await,
|
||||
|
||||
Reference in New Issue
Block a user