MCPcopy Index your code
hub / github.com/LeperGnome/bt

github.com/LeperGnome/bt @v1.2.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.2 ↗ · + Follow
107 symbols 280 edges 14 files 6 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Better tree (arguably)

Manipulate file tree in terminal.

Preview

Installation

bt is currently only supported on linux and macOS. Windows support is on todo list.

go install github.com/LeperGnome/bt/cmd/bt@v1.2.1

Or from source

make install

Or download prebuilt binaries from the latest release.

Usage

bt [flags] [directory]

Usage of bt:
      --file_preview       Enable file previews (default true)
      --highlight_indent   Highlight current indent (default true)
  -i, --in_place_render    In-place render (without alternate screen)
  -p, --padding uint       Edge padding for top and bottom (default 5)

Key bindings:

key desc
j / arr down Select next child
k / arr up Select previous child
h / arr left Move up a dir
l / arr right Enter selected directory
tab Mark selected child and move down
shift+tab Mark selected child and move up
d Move marked children (then 'p' to paste)
y Copy marked children (then 'p' to paste)
D Delete marked child
if / id Create file (if) / directory (id) in current directory
r Rename selected child
e Edit selected file in $EDITOR
gg Go to top most child in current directory
G Go to last child in current directory
H Toggle hidden files in current directory
enter Open / close selected directory or open file (xdg-open / open)
esc Clear error message / stop current operation / drop marks
? Toggle help
q / ctrl+c Exit

Configuration

You can configure bt via configuration file at $HOME/.config/bt/conf.yaml


padding: 5
file_preview: true
highlight_indent: true
in_place_render: false

Motivation

I find myself disliking a majority of column-based terminal file managers. The reason for that is - when I need to copy/move some files across nested subdirectories, I constantly lose context of where I am currently, because columns always go left and right. Even though those file managers are really mature and loaded with features (e.g. ranger, lf, xplr, nnn), it's uneasy for me to perform simple tasks.

I like how broot renders the ui, but I guess that it's mainly usable for exploring a file tree, but not manipulating it (at least I found it this way, when I had to type a target directory for move).

That's why I'm writing my own simple tool for simple use cases. It's currently lacking a bunch of features (see todo list below), but the fundamentals are here.

TODO

Functional:
- [x] Tree rendering
- [x] File preview
- [x] Scrolling trees, that don't fit the screen
- [x] Move files
- [x] Jump into empty directories
- [x] Copy / paste files
- [x] Not reading whole file contents, only fix size
- [x] Remove files
- [~] Resolve filename conflicts (kinda done)
- [x] Sorting
- [x] "G" to go bottom and "gg" to go top
- [x] Creating files and directories
- [x] Renaming files and directories
- [x] Handle fs updates
- [~] Error handling (permissions denied, etc) (kinda)
- [x] File permission in status bar
- [x] Stylesheets
- [x] Edit selected file in editor of choice
- [x] Help
- [x] Toggle hidden directories
- [x] Image preview (half-block only)
- [x] xdg-open files
- [x] Async preview
- [x] Mark multiple files
- [ ] Image preview TGP
- [ ] Custom delete cmd
- [ ] Search
- [ ] Marked to stdout on exit
- [ ] Jump to current directory
- [ ] Go higher then local root
- [ ] Make current directory a local root
- [ ] Windows support

Fixes:
- [x] Fix size notation
- [x] Check existing name on rename
- [x] "gg" drops previous operation
- [ ] File preview ignore control chars

Maintenance:
- [x] Tests (at least a little bit)
- [x] Release artifacts
- [x] CI
- [ ] Distribution
- [ ] CONTRIBUTING.md

Extension points exported contracts — how you extend this code

NodeSortingFunc (FuncType)
(no doc)
internal/tree/node.go

Core symbols most depended-on inside this repo

Render
called by 24
internal/ui/render.go
Len
called by 10
pkg/stack/stack.go
GetSelectedChild
called by 10
internal/tree/tree.go
MarkSelectedChild
called by 8
internal/tree/tree.go
processKeyDefault
called by 7
internal/state/state.go
SelectNextChild
called by 6
internal/tree/tree.go
ToggleMarkSelectedChild
called by 6
internal/tree/tree.go
readChildren
called by 6
internal/tree/node.go

Shape

Method 60
Function 29
Struct 16
FuncType 1
TypeAlias 1

Languages

Go100%

Modules by API surface

internal/tree/tree.go21 symbols
internal/state/state.go19 symbols
internal/ui/render.go16 symbols
internal/tree/node.go10 symbols
internal/tree/tree_test.go9 symbols
cmd/bt/main.go8 symbols
internal/ui/preview_gen.go7 symbols
pkg/stack/stack.go5 symbols
cmd/bt/main_test.go5 symbols
internal/ui/preview_gen_test.go2 symbols
internal/tree/fswatcher.go2 symbols
internal/config/config.go2 symbols

For agents

$ claude mcp add bt \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page