More logging improvements

pull/586/head
Arijit Basu 1 year ago
parent 903e0dda92
commit 70989b5fc3

@ -415,7 +415,7 @@ impl App {
fn handle_external(self, msg: ExternalMsg, key: Option<Key>) -> Result<Self> {
if self.config.general.read_only && !msg.is_read_only() {
self.log_error("Cannot execute code in read-only mode.".into())
self.log_error("could not execute code in read-only mode.".into())
} else {
use ExternalMsg::*;
match msg {
@ -594,7 +594,7 @@ impl App {
if self.config.general.enable_recover_mode {
vec![ExternalMsg::SwitchModeBuiltin("recover".into())]
} else {
vec![ExternalMsg::LogWarning("Key map not found.".into())]
vec![ExternalMsg::LogWarning("key map not found.".into())]
}
});
@ -619,7 +619,7 @@ impl App {
Ok(dir) => self.set_directory(dir),
Err(e) => {
self.directory_buffer = None;
self.log_error(format!("Failed to explore {pwd:?}: {e}"))
self.log_error(format!("could not explore {pwd:?}: {e}"))
}
}
}
@ -936,7 +936,7 @@ impl App {
}
self.explore_pwd()
}
Err(e) => self.log_error(format!("failed to enter {dir:?}: {e}")),
Err(e) => self.log_error(format!("could not enter {dir:?}: {e}")),
}
}
@ -1156,7 +1156,7 @@ impl App {
self.log_error(format!("{path:?} not found"))
}
} else {
self.log_error(format!("Cannot focus on {path:?}"))
self.log_error(format!("could not focus on {path:?}"))
}
}
@ -1204,7 +1204,7 @@ impl App {
} else if self.config.modes.custom.contains_key(mode) {
self.switch_mode_custom_keeping_input_buffer(mode)
} else {
self.log_error(format!("Mode not found: {mode:?}"))
self.log_error(format!("mode not found: {mode:?}"))
}
}
@ -1229,7 +1229,7 @@ impl App {
Ok(self)
} else {
self.log_error(format!("Builtin mode not found: {mode:?}"))
self.log_error(format!("builtin mode not found: {mode:?}"))
}
}
@ -1254,7 +1254,7 @@ impl App {
Ok(self)
} else {
self.log_error(format!("Custom mode not found: {mode:?}"))
self.log_error(format!("custom mode not found: {mode:?}"))
}
}
@ -1264,7 +1264,7 @@ impl App {
} else if self.config.layouts.custom.contains_key(layout) {
self.switch_layout_custom(layout)
} else {
self.log_error(format!("Layout not found: {layout:?}"))
self.log_error(format!("layout not found: {layout:?}"))
}
}
@ -1280,7 +1280,7 @@ impl App {
Ok(self)
} else {
self.log_error(format!("Builtin layout not found: {layout:?}"))
self.log_error(format!("builtin layout not found: {layout:?}"))
}
}
@ -1296,7 +1296,7 @@ impl App {
Ok(self)
} else {
self.log_error(format!("Custom layout not found: {layout:?}"))
self.log_error(format!("custom layout not found: {layout:?}"))
}
}

@ -1481,7 +1481,7 @@ xplr.config.modes.builtin.selection_ops = {
"$XPLR" -m 'UnSelectPath: %q' "$PTH"
"$XPLR" -m 'FocusPath: %q' "$BASENAME"
else
"$XPLR" -m 'LogError: %q' "Failed to copy $PTH_ESC to ./$BASENAME_ESC"
"$XPLR" -m 'LogError: %q' "could not copy $PTH_ESC to ./$BASENAME_ESC"
fi
done < "${XPLR_PIPE_SELECTION_OUT:?}")
read -p "[enter to continue]"
@ -1508,7 +1508,7 @@ xplr.config.modes.builtin.selection_ops = {
"$XPLR" -m 'LogSuccess: %q' "$PTH_ESC moved to ./$BASENAME_ESC"
"$XPLR" -m 'FocusPath: %q' "$BASENAME"
else
"$XPLR" -m 'LogError: %q' "Failed to move $PTH_ESC to ./$BASENAME_ESC"
"$XPLR" -m 'LogError: %q' "could not move $PTH_ESC to ./$BASENAME_ESC"
fi
done < "${XPLR_PIPE_SELECTION_OUT:?}")
read -p "[enter to continue]"
@ -1536,7 +1536,7 @@ xplr.config.modes.builtin.selection_ops = {
"$XPLR" -m 'UnSelectPath: %q' "$PTH"
"$XPLR" -m 'FocusPath: %q' "$BASENAME"
else
"$XPLR" -m 'LogError: %q' "Failed to softlink $PTH_ESC as ./$BASENAME_ESC"
"$XPLR" -m 'LogError: %q' "could not softlink $PTH_ESC as ./$BASENAME_ESC"
fi
done < "${XPLR_PIPE_SELECTION_OUT:?}")
read -p "[enter to continue]"
@ -1564,7 +1564,7 @@ xplr.config.modes.builtin.selection_ops = {
"$XPLR" -m 'UnSelectPath: %q' "$PTH"
"$XPLR" -m 'FocusPath: %q' "$BASENAME"
else
"$XPLR" -m 'LogError: %q' "Failed to hardlink $PTH_ESC as ./$BASENAME_ESC"
"$XPLR" -m 'LogError: %q' "could not hardlink $PTH_ESC as ./$BASENAME_ESC"
fi
done < "${XPLR_PIPE_SELECTION_OUT:?}")
read -p "[enter to continue]"
@ -1924,7 +1924,7 @@ xplr.config.modes.builtin.delete = {
if rm -rfv -- "${PTH:?}"; then
"$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted"
else
"$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC"
"$XPLR" -m 'LogError: %q' "could not delete $PTH_ESC"
"$XPLR" -m 'FocusPath: %q' "$PTH"
fi
done < "${XPLR_PIPE_RESULT_OUT:?}")
@ -1946,14 +1946,14 @@ xplr.config.modes.builtin.delete = {
if rmdir -v -- "${PTH:?}"; then
"$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted"
else
"$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC"
"$XPLR" -m 'LogError: %q' "could not delete $PTH_ESC"
"$XPLR" -m 'FocusPath: %q' "$PTH"
fi
else
if rm -v -- "${PTH:?}"; then
"$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted"
else
"$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC"
"$XPLR" -m 'LogError: %q' "could not delete $PTH_ESC"
"$XPLR" -m 'FocusPath: %q' "$PTH"
fi
fi

@ -31,7 +31,7 @@ pub fn get_tty() -> Result<fs::File> {
match fs::OpenOptions::new().read(true).write(true).open(tty) {
Ok(f) => Ok(f),
Err(e) => {
bail!(format!("Failed to open {tty}. {e}"))
bail!(format!("could not open {tty}. {e}"))
}
}
}

Loading…
Cancel
Save