Skip to content

Commit

Permalink
Print unknown if context path unset
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Nov 8, 2024
1 parent 8a59f9f commit 1fd93fa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/command/current.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub struct Current {}
impl JpreCommand for Current {
fn run(self, _context: Context) -> ESResult<(), JpreError> {
let path = get_context_path();
if !path.exists() {
println!("<unknown>");
return Ok(());
}
let link_target = std::fs::read_link(&path)
.change_context(JpreError::Unexpected)
.attach_printable_lazy(|| format!("Failed to read link target of {:?}", path))?;
Expand Down

0 comments on commit 1fd93fa

Please sign in to comment.