Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
feat: prompt shows current working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sehnryr committed Mar 25, 2023
1 parent af7982b commit 67b4c6f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,19 @@ fn main() -> Result<()> {
rl.set_helper(Some(Helper {
state: state.clone(),
}));
let prompt = "[wfcache-api]# ";

loop {
let line = rl.readline(&prompt);
let line = rl.readline(&format!(
"[{} {}]# ",
env!("CARGO_PKG_NAME"),
state
.borrow()
.current_lotus_dir
.file_name()
.unwrap_or("/".as_ref())
.to_str()
.unwrap()
));
match line {
Ok(_) => {}
Err(ReadlineError::Interrupted) => break, // Ctrl-C
Expand Down Expand Up @@ -172,7 +181,7 @@ fn parse_command(state: &mut State, line: &str) -> Result<()> {
Command::PrintFileMetadata(args) => stat::command(state, args),
Command::PrintWorkingDirectory(args) => pwd::command(state, args),
};

// Pad the output
println!();

Expand Down

0 comments on commit 67b4c6f

Please sign in to comment.