Skip to content

Commit 5035c7b

Browse files
committed
prepping for next release
1 parent 0120059 commit 5035c7b

File tree

5 files changed

+51
-22
lines changed

5 files changed

+51
-22
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- Git integration to display file statuses with a new `-G, --git-status` flag.
12+
- **Shell integration:** In interactive mode, pressing `Ctrl+s` now quits the application and prints the selected path to standard output, allowing `lstr` to be used as a file picker for other shell commands.
13+
- **Git integration:** To display file statuses, use the new `-G, --git-status` flag.
1314
- Shows status indicators for modified (`M`), new (`A`), untracked (`?`), and more.
1415
- Available in both classic `view` and `interactive` modes.
1516
- Added an optional `-s, --size` flag to display file sizes in both classic and interactive modes.

README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# lstr
22

3-
[![Build Status](https://github.com/bgreenwell/rjot/actions/workflows/rust.yml/badge.svg)](https://github.com/bgreenwell/rjot/actions)
3+
[![Build Status](https://github.com/bgreenwell/lstr/actions/workflows/rust.yml/badge.svg)](https://github.com/bgreenwell/lstr/actions)
44
[![Latest Version](https://img.shields.io/crates/v/lstr.svg)](https://crates.io/crates/lstr)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66

77
A blazingly fast, minimalist directory tree viewer, written in Rust. Inspired by the command line program [tree](https://github.com/Old-Man-Programmer/tree), with a powerful interactive mode.
88

99
![](assets/lstr-demo.gif)
10-
*An interactive overview of **lstr**'s project structure... using **lstr**.*
10+
*An interactive overview of `lstr`'s project structure... using `lstr`.*
1111
## Philosophy
1212

1313
- **Fast:** Runs directory scans in parallel by default to maximize speed on modern hardware.
@@ -29,7 +29,7 @@ A blazingly fast, minimalist directory tree viewer, written in Rust. Inspired by
2929

3030
## Installation
3131

32-
You need the Rust toolchain installed on your system to build **lstr**.
32+
You need the Rust toolchain installed on your system to build `lstr`.
3333

3434
1. **Clone the repository:**
3535
```bash
@@ -62,7 +62,7 @@ Note that `PATH` defaults to the current directory (`.`) if not specified.
6262
| `-L`, `--level <LEVEL>`| Maximum depth to descend. |
6363
| `-p`, `--permissions` | Display file permissions (Unix-like systems only). |
6464
| `-s`, `--size` | Display the size of files. |
65-
| `--expand-level <LEVEL>`| **Interactive mode only:** Initial depth to expand the interactive tree. |
65+
| `--expand-level <LEVEL>`| **Interactive mode only:** Initial depth to expand the interactive tree. |
6666

6767
-----
6868

@@ -78,6 +78,8 @@ Launch the TUI with `lstr interactive [OPTIONS] [PATH]`.
7878
| `` / `j` | Move selection down. |
7979
| `Enter` | **Context-aware action:**\<br/\>- If on a file: Open it in the default editor (`$EDITOR`).\<br/\>- If on a directory: Toggle expand/collapse. |
8080
| `q` / `Esc` | Quit the application normally. |
81+
| `Ctrl`+`s` | **Shell integration:** Quits and prints the selected path to stdout. |
82+
8183

8284
## Examples
8385

@@ -111,21 +113,21 @@ lstr -aG
111113
lstr interactive -gG --icons -s -p
112114
```
113115

114-
## Piping and Shell Interaction
116+
## Piping and shell interaction
115117

116118
The classic `view` mode is designed to work well with other command-line tools via pipes (`|`).
117119

118-
### Interactive Fuzzy Finding with **fzf**
120+
### Interactive fuzzy finding with `fzf`
119121

120122
This is a powerful way to instantly find any file in a large project.
121123

122124
```bash
123125
lstr -a -g --icons | fzf
124126
```
125127

126-
**fzf** will take the tree from **lstr** and provide an interactive search prompt to filter it.
128+
`fzf` will take the tree from `lstr` and provide an interactive search prompt to filter it.
127129

128-
### Paging Large Trees with less or bat
130+
### Paging large trees with `less` or `bat`
129131

130132
If a directory is too large to fit on one screen, pipe the output to a *pager*.
131133

@@ -137,9 +139,37 @@ lstr -L 10 | less -R
137139
lstr --icons | bat
138140
```
139141

142+
### Changing directories with `lstr`
143+
144+
You can use `lstr` as a visual `cd` command. Add the following function to your shell's startup file (e.g., `~/.bashrc`, `~/.zshrc`):
145+
146+
```bash
147+
# A function to visually change directories with lstr
148+
lcd() {
149+
# Run lstr and capture the selected path into a variable.
150+
# The TUI will draw on stderr, and the final path will be on stdout.
151+
local selected_dir
152+
selected_dir="$(lstr interactive -g --icons)"
153+
154+
# If the user selected a path (and didn't just quit), `cd` into it.
155+
# Check if the selection is a directory.
156+
if [[ -n "$selected_dir" && -d "$selected_dir" ]]; then
157+
cd "$selected_dir"
158+
fi
159+
}
160+
```
161+
162+
After adding this and starting a new shell session (or running `source ~/.bashrc`), you can simply run:
163+
164+
```bash
165+
lcd
166+
```
167+
168+
This will launch the `lstr` interactive UI. Navigate to the directory you want, press `Ctrl+s`, and your shell's current directory will instantly change.
169+
140170
## Performance and concurrency
141171
142-
By default, **lstr** uses a parallel directory walker to maximize speed on multi-core systems. This parallelism is managed by the excellent [rayon](https://crates.io/crates/rayon) thread pool, which is used internally by **lstr**'s directory traversal engine.
172+
By default, `lstr` uses a parallel directory walker to maximize speed on multi-core systems. This parallelism is managed by the excellent [rayon](https://crates.io/crates/rayon) thread pool, which is used internally by `lstr`'s directory traversal engine.
143173
144174
For advanced use cases, such as benchmarking or limiting CPU usage, you can control the number of threads by setting the `RAYON_NUM_THREADS` environment variable before running the command.
145175
@@ -151,4 +181,4 @@ RAYON_NUM_THREADS=1 lstr .
151181
152182
## Inspiration
153183
154-
The philosophy and functionality of **lstr** are heavily inspired by the excellent C-based [tree](https://github.com/Old-Man-Programmer/tree) command line program. This project is an attempt to recreate that classic utility in modern, safe Rust.
184+
The philosophy and functionality of `lstr` are heavily inspired by the excellent C-based [tree](https://github.com/Old-Man-Programmer/tree) command line program. This project is an attempt to recreate that classic utility in modern, safe Rust.

assets/demo.tape

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
# 1. Setup the output and terminal properties
44
Output "assets/lstr-demo.gif"
5-
Set Width 1200
6-
Set Height 600
7-
Set FontSize 16
8-
Set TypingSpeed 75ms
5+
#Set Width 1200
6+
#Set Height 600
7+
Set Width 1000
8+
Set Height 618
9+
Set FontSize 18
10+
Set TypingSpeed 65ms
911
Set Theme "Catppuccin Frappe"
1012

1113
# 2. Show the classic view with icons
@@ -16,14 +18,14 @@ Sleep 5s
1618
Ctrl+L
1719

1820
# 3. Show the classic view with size and permissions
19-
Type "lstr -gps"
21+
Type "lstr -Ggps --icons"
2022
Sleep 1s
2123
Enter
2224
Sleep 5s
2325
Ctrl+L
2426

2527
# 4. Show the interactive mode, pre-expanded
26-
Type "lstr interactive -gs --icons --expand-level 2"
28+
Type "lstr i -Ggps --icons --expand-level 2"
2729
Sleep 1s
2830
Enter
2931
Sleep 2s
@@ -35,14 +37,10 @@ Enter
3537
Sleep 2s
3638
Enter
3739
Sleep 1s
38-
Down 5
40+
Down 6
3941
Sleep 2s
4042
Enter
4143
Sleep 5s
4244
Type ":x"
4345
Enter
4446
Sleep 2s
45-
46-
# 6. Quit the application
47-
Type "q"
48-
Sleep 2s

assets/lstr-demo.gif

19.9 KB
Loading

assets/screenshot.png

-142 KB
Binary file not shown.

0 commit comments

Comments
 (0)