mirror of
https://github.com/sayanarijit/xplr.git
synced 2024-09-11 11:05:39 +03:00
parent
4d21a89050
commit
21f87d6a08
16
src/app.rs
16
src/app.rs
@ -1617,13 +1617,21 @@ impl App {
|
||||
}
|
||||
|
||||
fn call(mut self, command: Command) -> Result<Self> {
|
||||
self.msg_out.push_back(MsgOut::Call(command));
|
||||
Ok(self)
|
||||
if self.config.general.read_only.unwrap_or_default() {
|
||||
self.log_error("Cannot call command in read-only mode.".into())
|
||||
} else {
|
||||
self.msg_out.push_back(MsgOut::Call(command));
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
||||
fn call_silently(mut self, command: Command) -> Result<Self> {
|
||||
self.msg_out.push_back(MsgOut::CallSilently(command));
|
||||
Ok(self)
|
||||
if self.config.general.read_only.unwrap_or_default() {
|
||||
self.log_error("Cannot call command in read-only mode.".into())
|
||||
} else {
|
||||
self.msg_out.push_back(MsgOut::CallSilently(command));
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
||||
fn bash_exec(self, script: String) -> Result<Self> {
|
||||
|
@ -280,6 +280,9 @@ pub struct GeneralConfig {
|
||||
#[serde(default)]
|
||||
pub show_hidden: Option<bool>,
|
||||
|
||||
#[serde(default)]
|
||||
pub read_only: Option<bool>,
|
||||
|
||||
#[serde(default)]
|
||||
pub cursor: UiElement,
|
||||
|
||||
@ -311,6 +314,7 @@ pub struct GeneralConfig {
|
||||
impl GeneralConfig {
|
||||
pub fn extend(mut self, other: Self) -> Self {
|
||||
self.show_hidden = other.show_hidden.or(self.show_hidden);
|
||||
self.read_only = other.read_only.or(self.read_only);
|
||||
self.cursor = self.cursor.extend(other.cursor);
|
||||
self.prompt = self.prompt.extend(other.prompt);
|
||||
self.logs = self.logs.extend(other.logs);
|
||||
|
@ -1,6 +1,7 @@
|
||||
version: v0.5.0
|
||||
general:
|
||||
show_hidden: false
|
||||
read_only: false
|
||||
initial_sorting:
|
||||
- sorter: ByCanonicalIsDir
|
||||
reverse: true
|
||||
|
Loading…
Reference in New Issue
Block a user