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

Commit 67b4c6f

Browse files
committed
feat: prompt shows current working directory
1 parent af7982b commit 67b4c6f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/main.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,19 @@ fn main() -> Result<()> {
113113
rl.set_helper(Some(Helper {
114114
state: state.clone(),
115115
}));
116-
let prompt = "[wfcache-api]# ";
117116

118117
loop {
119-
let line = rl.readline(&prompt);
118+
let line = rl.readline(&format!(
119+
"[{} {}]# ",
120+
env!("CARGO_PKG_NAME"),
121+
state
122+
.borrow()
123+
.current_lotus_dir
124+
.file_name()
125+
.unwrap_or("/".as_ref())
126+
.to_str()
127+
.unwrap()
128+
));
120129
match line {
121130
Ok(_) => {}
122131
Err(ReadlineError::Interrupted) => break, // Ctrl-C
@@ -172,7 +181,7 @@ fn parse_command(state: &mut State, line: &str) -> Result<()> {
172181
Command::PrintFileMetadata(args) => stat::command(state, args),
173182
Command::PrintWorkingDirectory(args) => pwd::command(state, args),
174183
};
175-
184+
176185
// Pad the output
177186
println!();
178187

0 commit comments

Comments
 (0)