Skip to content

Commit

Permalink
fix saved location of remembered command
Browse files Browse the repository at this point in the history
  • Loading branch information
sslivkoff committed Oct 21, 2023
1 parent 6de6dc3 commit 861684e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/remember.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) fn load_remembered_command(cryo_dir: PathBuf) -> Result<RememberedCom
let path = get_remembered_command_path(cryo_dir)?;
let mut contents = String::new();
let mut file = File::open(path)
.map_err(|_| ParseError::ParseError("could not open remembered file".to_string()))?;
.map_err(|_| ParseError::ParseError("either 1) specify datasets to collect or 2) specify a command to remember with --remember".to_string()))?;
file.read_to_string(&mut contents)
.map_err(|_| ParseError::ParseError("could not read rememebered file".to_string()))?;
let remembered: RememberedCommand = serde_json::from_str(&contents)
Expand Down
7 changes: 5 additions & 2 deletions crates/cli/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ pub async fn run(args: args::Args) -> Result<Option<FreezeSummary>, CollectError
return handle_help_subcommands(args).await
}

let cryo_dir: std::path::PathBuf = args.output_dir.clone().into();
let cryo_dir = cryo_dir.join(".cryo");

// remember previous command
let args = if args.datatype.is_empty() {
let remembered = remember::load_remembered_command(args.output_dir.clone().into())?;
let remembered = remember::load_remembered_command(cryo_dir.clone())?;
if remembered.cryo_version != cryo_freeze::CRYO_VERSION {
eprintln!("remembered command comes from different cryo version, proceed with caution");
eprintln!();
Expand All @@ -35,7 +38,7 @@ pub async fn run(args: args::Args) -> Result<Option<FreezeSummary>, CollectError
if args.remember {
println!("remembering this command for future use");
println!();
remember::save_remembered_command(args.output_dir.clone().into(), &args)?;
remember::save_remembered_command(cryo_dir, &args)?;
}

// handle regular flow
Expand Down

0 comments on commit 861684e

Please sign in to comment.