mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 22:54:24 +01:00
fix: check if working directory has changed before asking (#1733)
This commit is contained in:
@@ -76,13 +76,17 @@ pub async fn build_session(
|
|||||||
process::exit(1);
|
process::exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ask user if they want to change the working directory
|
let current_workdir =
|
||||||
let change_workdir = cliclack::confirm(format!("{} The working directory of this session was set to {}. It does not match the current working directory. Would you like to change it?", style("WARNING:").yellow(), style(metadata.working_dir.display()).cyan()))
|
std::env::current_dir().expect("Failed to get current working directory");
|
||||||
.initial_value(true)
|
if current_workdir != metadata.working_dir {
|
||||||
.interact().expect("Failed to get user input");
|
// Ask user if they want to change the working directory
|
||||||
|
let change_workdir = cliclack::confirm(format!("{} The working directory of this session was set to {}. It does not match the current working directory. Would you like to change it?", style("WARNING:").yellow(), style(metadata.working_dir.display()).cyan()))
|
||||||
|
.initial_value(true)
|
||||||
|
.interact().expect("Failed to get user input");
|
||||||
|
|
||||||
if change_workdir {
|
if change_workdir {
|
||||||
std::env::set_current_dir(metadata.working_dir).unwrap();
|
std::env::set_current_dir(metadata.working_dir).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user