summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/args.rs12
-rw-r--r--src/config.rs5
-rw-r--r--src/status.rs20
-rw-r--r--src/tab.rs5
4 files changed, 33 insertions, 9 deletions
diff --git a/src/args.rs b/src/args.rs
index f49a697..0c3bbc3 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -2,7 +2,7 @@ use clap::Parser;
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about)]
-/// FM : dired like file manager{n}
+/// FM : dired / ranger like file manager{n}
pub struct Args {
/// Starting path. directory or file
#[arg(short, long, default_value_t = String::from("."))]
@@ -17,14 +17,18 @@ pub struct Args {
pub dual: bool,
/// Display file metadata ? default to true
- #[arg(short, long, default_value_t = false)]
- pub metadata: bool,
+ #[arg(group = "full", conflicts_with = "metadata", short = 'S', long)]
+ pub simple: Option<bool>,
+
+ /// Display file metadata ? default to true
+ #[arg(group = "full", conflicts_with = "simple", short = 'M', long)]
+ pub metadata: Option<bool>,
/// Use second pane as preview ? default to false
#[arg(short = 'P', long, default_value_t = false)]
pub preview: bool,
/// Display all files (hidden)
- #[arg(short, long, default_value_t = false)]
+ #[arg(short = 'A', long, default_value_t = false)]
pub all: bool,
}
diff --git a/src/config.rs b/src/config.rs
index 1e4a588..00b8e41 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -15,6 +15,7 @@ use crate::utils::is_program_in_path;
pub struct Settings {
pub dual: bool,
pub full: bool,
+ pub all: bool,
}
impl Settings {
@@ -27,6 +28,10 @@ impl Settings {
serde_yaml::Value::Bool(false) => self.full = false,
_ => self.full = true,
}
+ match yaml["all"] {
+ serde_yaml::Value::Bool(false) => self.all = false,
+ _ => self.all = true,
+ }
}
}
diff --git a/src/status.rs b/src/status.rs
index 4ae9f5a..3dae017 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -112,7 +112,7 @@ impl Status {
let preview_second = args.preview;
let start_folder = std::fs::canonicalize(std::path::PathBuf::from(&args.path))?;
let nvim_server = args.server.clone();
- let display_full = args.metadata || settings.full;
+ let display_full = Self::parse_display_full(args.simple, args.metadata, settings.full);
let dual_pane = (args.dual || settings.dual) && Self::display_wide_enough(&term)?;
let Ok(shell_menu) = ShellMenu::new(TUIS_PATH) else {
@@ -141,8 +141,8 @@ impl Status {
let mount_points = Self::disks_mounts(sys.disks());
let tabs = [
- Tab::new(&args, height, users_cache, &mount_points)?,
- Tab::new(&args, height, users_cache2, &mount_points)?,
+ Tab::new(&args, height, users_cache, settings, &mount_points)?,
+ Tab::new(&args, height, users_cache2, settings, &mount_points)?,
];
Ok(Self {
tabs,
@@ -182,6 +182,20 @@ impl Status {
std::process::exit(1);
}
+ fn parse_display_full(
+ simple_args: Option<bool>,
+ metadata_args: Option<bool>,
+ full_config: bool,
+ ) -> bool {
+ if let Some(simple_args) = simple_args {
+ return !simple_args;
+ }
+ if let Some(metadata_args) = metadata_args {
+ return metadata_args;
+ }
+ full_config
+ }
+
/// Select the other tab if two are displayed. Does nother otherwise.
pub fn next(&mut self) {
if !self.dual_pane {
diff --git a/src/tab.rs b/src/tab.rs
index d0c6caf..b46f653 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -6,7 +6,7 @@ use users::UsersCache;
use crate::args::Args;
use crate::completion::{Completion, InputCompleted};
-use crate::config::Colors;
+use crate::config::{Colors, Settings};
use crate::content_window::ContentWindow;
use crate::fileinfo::{FileInfo, FileKind, PathContent};
use crate::filter::FilterKind;
@@ -62,6 +62,7 @@ impl Tab {
args: &Args,
height: usize,
users_cache: UsersCache,
+ settings: &Settings,
mount_points: &[&path::Path],
) -> Result<Self> {
let path = std::fs::canonicalize(path::Path::new(&args.path))?;
@@ -72,7 +73,7 @@ impl Tab {
};
let directory = Directory::empty(start_dir, &users_cache)?;
let filter = FilterKind::All;
- let show_hidden = args.all;
+ let show_hidden = args.all || settings.all;
let mut path_content = PathContent::new(start_dir, users_cache, &filter, show_hidden)?;
let mode = Mode::Normal;
let previous_mode = Mode::Normal;