Skip to content

Commit 1fd93fa

Browse files
committed
Print unknown if context path unset
1 parent 8a59f9f commit 1fd93fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/command/current.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ pub struct Current {}
1212
impl JpreCommand for Current {
1313
fn run(self, _context: Context) -> ESResult<(), JpreError> {
1414
let path = get_context_path();
15+
if !path.exists() {
16+
println!("<unknown>");
17+
return Ok(());
18+
}
1519
let link_target = std::fs::read_link(&path)
1620
.change_context(JpreError::Unexpected)
1721
.attach_printable_lazy(|| format!("Failed to read link target of {:?}", path))?;

0 commit comments

Comments
 (0)