Skip to content

Commit f7f4a12

Browse files
authored
Merge pull request #90 from chaqchase/feat/improvements-fixes
improvements and fixes
2 parents 6506342 + 90bd596 commit f7f4a12

File tree

15 files changed

+619
-113
lines changed

15 files changed

+619
-113
lines changed

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.10] - 2025-01-06
9+
10+
### Added
11+
12+
- Enhanced symlink support:
13+
14+
- New symlink metadata retrieval and display
15+
- Improved symlink target information in output
16+
- Better visual representation of symlinks
17+
18+
- New permission format options:
19+
20+
- `--permission-format` argument with multiple display formats:
21+
- symbolic (default)
22+
- octal
23+
- binary
24+
- verbose
25+
- compact
26+
- Configurable default permission format in settings in configuration file
27+
28+
- Enhanced grid format configuration:
29+
- New `--grid-ignore` option
30+
- Configurable grid width settings in configuration file
31+
32+
### Changed
33+
34+
- Improved plugin configuration with enhanced tilde expansion for plugin directories
35+
36+
- Refined symlink target display positioning in LongFormatter output
37+
- Enhanced documentation and README formatting
38+
- Added completions archive to release workflow
39+
40+
### Fixed
41+
42+
- Fixed symlink handling to respect 'no_symlinks' argument
43+
844
## [0.3.9] - 2025-01-04
945

1046
### Added

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ members = ["lla", "lla_plugin_interface", "lla_plugin_utils", "plugins/*"]
55
[workspace.package]
66
description = "Blazing Fast and highly customizable ls Replacement with Superpowers"
77
authors = ["Achaq <hi@achaq.dev>"]
8-
version = "0.3.9"
8+
version = "0.3.10"
99
categories = ["utilities", "file-system", "cli", "file-management"]
1010
edition = "2021"
1111
license = "MIT"

README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<p align="center">
88
Modern, customizable, feature-rich and extensible `ls` replacement.
99
<br />
10-
<br />
1110
<a href="https://lla.chaqchase.com">Documentation</a>
1211
·
1312
<a href="#features">Features</a>
@@ -137,7 +136,8 @@ lla -T
137136
Space-efficient layout for dense directories:
138137

139138
```bash
140-
lla -g
139+
lla -g # Basic grid view
140+
lla -g --grid-ignore # Grid view ignoring terminal width (Warning: may extend beyond screen)
141141
```
142142

143143
<img src="https://github.com/user-attachments/assets/b81d01ea-b830-4833-8791-7b62ff9137df" className="rounded-2xl" alt="grid" />
@@ -206,13 +206,13 @@ will show a detailed listing of all files and directories in the current directo
206206

207207
#### Basic Views
208208

209-
| Command | Short | Description | Example |
210-
| --------- | ----- | --------------------------------------- | -------- |
211-
| (default) | | List current directory | `lla` |
212-
| `--long` | `-l` | Detailed file information with metadata | `lla -l` |
213-
| `--tree` | `-t` | Hierarchical directory visualization | `lla -t` |
214-
| `--table` | `-T` | Structured data display | `lla -T` |
215-
| `--grid` | `-g` | Organized grid layout | `lla -g` |
209+
| Command | Short | Description | Example |
210+
| --------- | ----- | ----------------------------------------------------------------------------------------------------------------- | -------- |
211+
| (default) | | List current directory | `lla` |
212+
| `--long` | `-l` | Detailed file information with metadata | `lla -l` |
213+
| `--tree` | `-t` | Hierarchical directory visualization | `lla -t` |
214+
| `--table` | `-T` | Structured data display | `lla -T` |
215+
| `--grid` | `-g` | Organized grid layout you can use `-g --grid-ignore` to ignore terminal width (Warning: may extend beyond screen) | `lla -g` |
216216

217217
#### Advanced Views
218218

@@ -226,11 +226,12 @@ will show a detailed listing of all files and directories in the current directo
226226

227227
#### Display Modifiers
228228

229-
| Command | Description | Example |
230-
| ------------ | ------------------------------------ | ---------------- |
231-
| `--icons` | Show icons for files and directories | `lla --icons` |
232-
| `--no-icons` | Hide icons for files and directories | `lla --no-icons` |
233-
| `--no-color` | Disable all colors in the output | `lla --no-color` |
229+
| Command | Description | Example |
230+
| --------------------- | ------------------------------------------------------------------------------------- | ------------------------------- |
231+
| `--icons` | Show icons for files and directories | `lla --icons` |
232+
| `--no-icons` | Hide icons for files and directories | `lla --no-icons` |
233+
| `--no-color` | Disable all colors in the output | `lla --no-color` |
234+
| `--permission-format` | Set the format for displaying permissions (symbolic, octal, binary, verbose, compact) | `lla --permission-format octal` |
234235

235236
### Sort & Filter Options
236237

@@ -321,13 +322,15 @@ will show a detailed listing of all files and directories in the current directo
321322

322323
### Configuration & Setup
323324

324-
| Command | Description | Example |
325-
| ------------ | --------------------------------- | --------------------- |
326-
| `init` | Initialize the configuration file | `lla init` |
327-
| `config` | View or modify configuration | `lla config` |
328-
| `theme` | Interactive theme manager | `lla theme` |
329-
| `completion` | Generate shell completion scripts | `lla completion bash` |
330-
| `clean` | Clean up invalid plugins | `lla clean` |
325+
| Command | Description | Example |
326+
| --------------- | --------------------------------- | ------------------------------------------------------------------------------- |
327+
| `init` | Initialize the configuration file | `lla init` |
328+
| `config` | View or modify configuration | `lla config` |
329+
| `theme` | Interactive theme manager | `lla theme` |
330+
| `theme pull` | Pull the built-in themes | `lla theme pull` |
331+
| `theme install` | Install theme from file/directory | `lla theme install /path/to/theme.toml`<br>`lla theme install /path/to/themes/` |
332+
| `completion` | Generate shell completion scripts | `lla completion bash` |
333+
| `clean` | Clean up invalid plugins | `lla clean` |
331334

332335
### General Options
333336

lla/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ walkdir.workspace = true
2828
tempfile.workspace = true
2929
users.workspace = true
3030
parking_lot.workspace = true
31-
lla_plugin_interface = { version = "0.3.9", path = "../lla_plugin_interface" }
32-
lla_plugin_utils = { version = "0.3.9", path = "../lla_plugin_utils" }
31+
lla_plugin_interface = { version = "0.3.10", path = "../lla_plugin_interface" }
32+
lla_plugin_utils = { version = "0.3.10", path = "../lla_plugin_utils" }
3333
once_cell.workspace = true
3434
dashmap.workspace = true
3535
unicode-width.workspace = true

lla/src/commands/args.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct Args {
1010
pub tree_format: bool,
1111
pub table_format: bool,
1212
pub grid_format: bool,
13+
pub grid_ignore: bool,
1314
pub sizemap_format: bool,
1415
pub timeline_format: bool,
1516
pub git_format: bool,
@@ -36,6 +37,7 @@ pub struct Args {
3637
pub no_symlinks: bool,
3738
pub no_dotfiles: bool,
3839
pub dotfiles_only: bool,
40+
pub permission_format: String,
3941
pub command: Option<Command>,
4042
}
4143

@@ -116,6 +118,11 @@ impl Args {
116118
.long("grid")
117119
.help("Use grid listing format (overrides config format)"),
118120
)
121+
.arg(
122+
Arg::with_name("grid-ignore")
123+
.long("grid-ignore")
124+
.help("Use grid view ignoring terminal width (Warning: output may extend beyond screen width)"),
125+
)
119126
.arg(
120127
Arg::with_name("sizemap")
121128
.short('S')
@@ -268,6 +275,14 @@ impl Args {
268275
.long("dotfiles-only")
269276
.help("Show only dot files and directories (those starting with a dot)"),
270277
)
278+
.arg(
279+
Arg::with_name("permission-format")
280+
.long("permission-format")
281+
.help("Format for displaying permissions (symbolic, octal, binary, verbose, compact)")
282+
.takes_value(true)
283+
.possible_values(&["symbolic", "octal", "binary", "verbose", "compact"])
284+
.default_value(&config.permission_format),
285+
)
271286
.subcommand(
272287
SubCommand::with_name("install")
273288
.about("Install a plugin")
@@ -440,6 +455,7 @@ impl Args {
440455
tree_format: config.default_format == "tree",
441456
table_format: config.default_format == "table",
442457
grid_format: config.default_format == "grid",
458+
grid_ignore: false,
443459
sizemap_format: config.default_format == "sizemap",
444460
timeline_format: config.default_format == "timeline",
445461
git_format: config.default_format == "git",
@@ -466,6 +482,7 @@ impl Args {
466482
no_symlinks: false,
467483
no_dotfiles: config.filter.no_dotfiles,
468484
dotfiles_only: false,
485+
permission_format: config.permission_format.clone(),
469486
command: Some(Command::Shortcut(ShortcutAction::Run(
470487
potential_shortcut.clone(),
471488
args[2..].to_vec(),
@@ -592,6 +609,7 @@ impl Args {
592609
|| (!has_format_flag && config.default_format == "table"),
593610
grid_format: matches.is_present("grid")
594611
|| (!has_format_flag && config.default_format == "grid"),
612+
grid_ignore: matches.is_present("grid-ignore"),
595613
sizemap_format: matches.is_present("sizemap")
596614
|| (!has_format_flag && config.default_format == "sizemap"),
597615
timeline_format: matches.is_present("timeline")
@@ -636,6 +654,10 @@ impl Args {
636654
no_symlinks: matches.is_present("no-symlinks"),
637655
no_dotfiles: matches.is_present("no-dotfiles") || config.filter.no_dotfiles,
638656
dotfiles_only: matches.is_present("dotfiles-only"),
657+
permission_format: matches
658+
.value_of("permission-format")
659+
.unwrap_or(&config.permission_format)
660+
.to_string(),
639661
command,
640662
}
641663
}

lla/src/commands/file_utils.rs

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::plugin::PluginManager;
1414
use crate::sorter::{AlphabeticalSorter, DateSorter, FileSorter, SizeSorter, SortOptions};
1515
use lla_plugin_interface::proto::{DecoratedEntry, EntryMetadata};
1616
use rayon::prelude::*;
17+
use std::collections::HashMap;
1718
use std::os::unix::fs::MetadataExt;
1819
use std::path::PathBuf;
1920
use std::sync::Arc;
@@ -148,7 +149,7 @@ pub fn list_and_decorate_files(
148149
)?
149150
.into_par_iter()
150151
.filter_map(|path| {
151-
let fs_metadata = path.metadata().ok()?;
152+
let fs_metadata = path.symlink_metadata().ok()?;
152153
let mut metadata = convert_metadata(&fs_metadata);
153154

154155
let is_dotfile = path
@@ -168,7 +169,7 @@ pub fn list_and_decorate_files(
168169
} else if args.files_only {
169170
metadata.is_file
170171
} else if args.symlinks_only {
171-
metadata.is_symlink
172+
metadata.is_symlink && !args.no_symlinks
172173
} else {
173174
let include_dirs = !args.no_dirs;
174175
let include_files = !args.no_files;
@@ -197,10 +198,20 @@ pub fn list_and_decorate_files(
197198
return None;
198199
}
199200

201+
let mut custom_fields = HashMap::new();
202+
if metadata.is_symlink {
203+
if let Ok(target) = std::fs::read_link(&path) {
204+
custom_fields.insert(
205+
"symlink_target".to_string(),
206+
target.to_string_lossy().into_owned(),
207+
);
208+
}
209+
}
210+
200211
Some(DecoratedEntry {
201212
path: path.to_string_lossy().into_owned(),
202213
metadata: Some(metadata),
203-
custom_fields: Default::default(),
214+
custom_fields,
204215
})
205216
})
206217
.collect();
@@ -314,15 +325,29 @@ fn create_base_filter(pattern: &str, case_insensitive: bool) -> Box<dyn FileFilt
314325

315326
pub fn create_formatter(args: &Args) -> Box<dyn FileFormatter> {
316327
if args.fuzzy_format {
317-
Box::new(FuzzyFormatter::new(args.show_icons))
328+
Box::new(FuzzyFormatter::new(
329+
args.show_icons,
330+
args.permission_format.clone(),
331+
))
318332
} else if args.long_format {
319-
Box::new(LongFormatter::new(args.show_icons))
333+
Box::new(LongFormatter::new(
334+
args.show_icons,
335+
args.permission_format.clone(),
336+
))
320337
} else if args.tree_format {
321338
Box::new(TreeFormatter::new(args.show_icons))
322339
} else if args.table_format {
323-
Box::new(TableFormatter::new(args.show_icons))
340+
Box::new(TableFormatter::new(
341+
args.show_icons,
342+
args.permission_format.clone(),
343+
))
324344
} else if args.grid_format {
325-
Box::new(GridFormatter::new(args.show_icons))
345+
let config = Config::load(&Config::get_config_path()).unwrap_or_default();
346+
Box::new(GridFormatter::new(
347+
args.show_icons,
348+
args.grid_ignore || config.formatters.grid.ignore_width,
349+
config.formatters.grid.max_width,
350+
))
326351
} else if args.sizemap_format {
327352
Box::new(SizeMapFormatter::new(args.show_icons))
328353
} else if args.timeline_format {

0 commit comments

Comments
 (0)