mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 19:45:23 +00:00
fix: filtering system directories in gitrepos
This commit is contained in:
parent
3d647b2010
commit
dd14bd4f8d
20
README.md
20
README.md
@ -20,3 +20,23 @@
|
||||
```
|
||||
|
||||
The revolution will be televised.
|
||||
|
||||
|
||||
## 📺 About
|
||||
`Television` is a blazingly fast general purpose fuzzy finder TUI written in Rust. It is inspired by the neovim `Telescope` plugin and the `fzf` command line tool. It is designed to be fast, efficient, easy to use and easily extensible. It is built on top of `tokio`, `ratatui` and the `nucleo` matcher which is used in the `helix` editor.
|
||||
|
||||
## 📺 Design
|
||||
`Television`'s design is based on the concept of `Channels`. A `Channel` is a source of data that can be used for fuzzy
|
||||
finding. A `Channel` can be anything from a file system directory, a git repository, a list of strings, a list of
|
||||
numbers, etc. `Television` provides a set of built-in `Channels` that can be used out of the box. However, `Television`
|
||||
is designed to be easily extensible and allows users to define their own custom `Channels` by implementing a simple
|
||||
trait.
|
||||
|
||||
## Built-in Channels
|
||||
- `Files`: search through files in a directory tree.
|
||||
- `Text`: search through textual content in a directory tree.
|
||||
- `GitRepos`: search through git repositories anywhere on the file system.
|
||||
- `Env`: search through environment variables and their values.
|
||||
- `Alias`: search through shell aliases and their values.
|
||||
- `Stdin`: search through lines of text from stdin.
|
||||
|
||||
|
@ -4,6 +4,7 @@ use std::{collections::HashSet, path::PathBuf};
|
||||
use ignore::{overrides::Override, types::TypesBuilder, WalkBuilder};
|
||||
use infer::Infer;
|
||||
use lazy_static::lazy_static;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::config::default_num_threads;
|
||||
|
||||
@ -26,9 +27,14 @@ pub fn walk_builder(
|
||||
|
||||
// ignore paths
|
||||
if let Some(paths) = ignore_paths {
|
||||
for path in paths {
|
||||
builder.add_ignore(path);
|
||||
}
|
||||
builder.filter_entry(move |e| {
|
||||
let path = e.path();
|
||||
if paths.iter().any(|p| path.starts_with(p)) {
|
||||
debug!("Ignoring path: {:?}", path);
|
||||
return false;
|
||||
}
|
||||
true
|
||||
});
|
||||
}
|
||||
|
||||
builder.threads(n_threads);
|
||||
|
Loading…
x
Reference in New Issue
Block a user