fixed push command to store current directory before changing directory

This commit is contained in:
2024-11-27 23:55:24 +01:00
parent ce096d2430
commit e6879afd58
+3 -1
View File
@@ -3,6 +3,7 @@ mod stack;
use std::io::{Result, Error, ErrorKind};
use std::path::PathBuf;
use std::env::current_dir;
use clap::{FromArgMatches, Parser};
use arguments::*;
use stack::Stack;
@@ -22,7 +23,8 @@ fn main() -> Result<()> {
}
pub fn handle_push (args: &PushArgs, stack: &mut Stack) -> Result<()> { // TODO: handle arguments
stack.push_entry(&args.path)?;
let current_path = current_dir()?;
stack.push_entry(&current_path)?;
println!("{}", args.path.to_str().unwrap());
return Ok(());
}