# oxinav-core
Domain logic for [OxiNav](https://github.com/MadsAndreasen/oxinav), a
keyboard-first dual-pane file manager. This crate has no UI dependency and is
usable on its own.
All filesystem access goes through the `Filesystem` trait, so everything here
is testable against an in-memory mock rather than real directories.
## What's in it
- **`operation`** — `Operation` (copy, move, rename, delete, create dir/file,
symlink, extract and create archive) executed by `OperationEngine`, with
pre-flight checks that reject an operation before touching the disk. Batch
operations report progress and are cancellable. Also content search with
ripgrep's engine, capped and cancellable.
- **`pane`** — pane state: listing, cursor and multi-selection, sorting,
hidden-file handling, a glob/substring name filter, and back/forward
directory history.
- **`archive`** — archive format detection, the entry-path guard that keeps
extraction inside its destination, and the entry model and default name for
packing a selection into a zip or tar.
- **`viewer`** — classifies file bytes as text or binary and prepares a capped
display form, including a hex dump, with the detected language of text.
- **`highlight`** — language detection and syntax highlighting (`syntect` with
bat's syntaxes and themes) into UI-neutral lines of coloured spans.
- **`search`** — content-search queries (smart case, scoped by a pane's
hidden-file setting and name filter), hits and snippets.
- **`launch`** — decides how to open a terminal or the user's editor
(`$TERMINAL`, `xdg-terminal-exec`, desktop defaults, `$VISUAL`/`$EDITOR`)
as a pure function over an injected environment.
- **`bookmarks`** — named directories and their on-disk format.
- **`session`** — the state carried into the next run (both panes' directory,
theme, hidden files, sort order) and its on-disk format.
- **`uri`** — encodes paths as a `text/uri-list` payload for drag-and-drop,
percent-encoding raw bytes so names that are not valid UTF-8 survive.
- **`command`** — the command palette's action list and fuzzy matching.
## Example
```rust
use oxinav_core::operation::{Operation, OperationEngine, StdFilesystem};
let engine = OperationEngine::new(StdFilesystem);
engine.execute(&Operation::CreateDir { path: "/tmp/demo".into() })?;
# Ok::<(), oxinav_core::error::OxiNavError>(())
```
## License
MIT