summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2019-11-03 13:22:53 +0100
committerCanop <cano.petrole@gmail.com>2019-11-03 13:22:53 +0100
commit803a8d2aa19b520530a94a4013ac33c3b296fe6a (patch)
tree7f04462a68e73a614dba6b9770fcddc299c8c2c1
parent9882589d942986386cf5f4eafe02f027924db952 (diff)
broot v0.10.0v0.10.0
This version is based on crossterm 0.13 and termimad 0.7.1. Fix #25 Fix #70
-rw-r--r--CHANGELOG.md8
-rw-r--r--Cargo.lock34
-rw-r--r--Cargo.toml13
-rw-r--r--src/app.rs31
-rw-r--r--src/cli.rs7
-rw-r--r--src/commands.rs2
-rw-r--r--src/conf.rs4
-rw-r--r--src/displayable_tree.rs8
-rw-r--r--src/flat_tree.rs17
-rw-r--r--src/help_content.rs2
-rw-r--r--src/help_states.rs22
-rw-r--r--src/screens.rs7
-rw-r--r--src/skin.rs16
-rw-r--r--src/skin_conf.rs2
-rw-r--r--src/verb_conf.rs4
-rw-r--r--src/verb_store.rs2
-rw-r--r--src/verbs.rs2
-rw-r--r--website/docs/documentation/usage.md40
-rw-r--r--website/docs/img/20191030-dev-sizes.pngbin0 -> 26053 bytes
19 files changed, 134 insertions, 87 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4ddd7bd..35c562f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
-### next version
-* moved to the new versions of crossterm and termimad
+<a name="v0.10.0"></a>
+### v0.10.0 - 2019-11-03
+* moved to the crossterm 0.13 and termimad 0.7.1
+* broot runs on stderr,
+* broot can run in a subshell
+Those changes allow tricks like `my_unix_command "$(broot)"` when you do `:pp` to print the path on stdout from broot
<a name="v0.9.6"></a>
### v0.9.6 - 2019-09-20
diff --git a/Cargo.lock b/Cargo.lock
index a4ee123..ea351f7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -88,12 +88,12 @@ dependencies = [
[[package]]
name = "broot"
-version = "0.9.6"
+version = "0.10.0"
dependencies = [
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossterm 0.12.1",
+ "crossterm 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"custom_error 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"directories 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -105,9 +105,9 @@ dependencies = [
"opener 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"simplelog 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "termimad 0.7.0",
+ "termimad 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "umask 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "umask 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"users 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -226,7 +226,8 @@ dependencies = [
[[package]]
name = "crossterm"
-version = "0.12.1"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossterm_winapi 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -643,13 +644,14 @@ dependencies = [
[[package]]
name = "termimad"
-version = "0.7.0"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossterm 0.12.1",
+ "crossterm 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"minimad 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "thiserror 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "thiserror 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -662,15 +664,15 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "thiserror-impl 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "thiserror-impl 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.3"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -706,7 +708,7 @@ dependencies = [
[[package]]
name = "umask"
-version = "0.1.6"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -795,6 +797,7 @@ dependencies = [
"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
+"checksum crossterm 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f49c1d3b343c7a241afbfd0c19ace7dd2118c0df676ac5ea7fe0cce93d357df"
"checksum crossterm_winapi 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df25e92a352488d9b3e0215e4e99402945993026159f98b477047719f16a6530"
"checksum custom_error 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93a0fc65739ae998afc8d68e64bdac2efd1bc4ffa1a0703d171ef2defae3792f"
"checksum directories 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c"
@@ -847,13 +850,14 @@ dependencies = [
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
"checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5"
+"checksum termimad 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2d3a0a1a36bad52fbc6fb868e062f0ad59ad5aa50a3608321ab5cda164dce28"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-"checksum thiserror 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4d29c937875c7fdf8af9b1edac17ebbe167e342a01072ce53b168c544c8a7608"
-"checksum thiserror-impl 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "836d68a4d4b9be617c45ac0b2d3aefbca3c3945947c81365bbb341fffbdccd1b"
+"checksum thiserror 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fe148fa0fc3363a27092d48f7787363ded15bb8623c5d5dd4e2e9f23e4b21bc"
+"checksum thiserror-impl 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "258da67e99e590650fa541ac6be764313d23e80cefb6846b516deb8de6b6d921"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7aabe75941d914b72bf3e5d3932ed92ce0664d49d8432305a8b547c37227724"
-"checksum umask 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a0bb95419130b051858e34f62abc738d386d823303084709c39c6484f62769ab"
+"checksum umask 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a29fca9e712d45d03bafd2e56a297292708da501b9967338e8a839477f8c92af"
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum users 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c72f4267aea0c3ec6d07eaabea6ead7c5ddacfafc5e22bcf8d186706851fb4cf"
diff --git a/Cargo.toml b/Cargo.toml
index 22a7d71..e1e13c1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "broot"
-version = "0.9.6"
+version = "0.10.0"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/broot"
documentation = "https://dystroy.org/broot"
@@ -24,9 +24,9 @@ clap = "2.33"
glob = "0.3"
crossbeam = "0.7"
opener = "0.4"
-crossterm = "0.12.1"
-umask = "0.1.4"
-termimad = "0.7.0"
+crossterm = "0.13"
+umask = "0.1.7"
+termimad = "0.7.1"
id-arena = "2.2.1"
lazy-regex = "0.1"
@@ -41,6 +41,7 @@ lto = true # link time optimization - roughly halves the size of the exec
codegen-units = 1 # this removes a few hundred bytes from the final exec size
[patch.crates-io]
-termimad = { path = "../termimad" }
-crossterm = { path = "../crossterm-rs/crossterm" }
+# termimad = { path = "../termimad" }
+# crossterm = { path = "../crossterm-rs/crossterm" }
+# umask = { path = "../umask" }
diff --git a/src/app.rs b/src/app.rs
index 841bb4e..b035471 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -11,11 +11,9 @@ use std::io::Write;
use crossterm::{
cursor,
- DisableMouseCapture,
- EnableMouseCapture,
- EnterAlternateScreen,
+ input::{DisableMouseCapture, EnableMouseCapture},
queue,
- LeaveAlternateScreen,
+ screen::{EnterAlternateScreen, LeaveAlternateScreen},
};
use termimad::EventSource;
@@ -178,10 +176,11 @@ impl App {
let mut cmd = cmd;
debug!("action: {:?}", &cmd.action);
screen.read_size(con)?;
- screen.input_field.display_on(w)?;
- self.state().write_flags(w, screen, con)?;
- screen.write_spinner(w, false)?;
- match self.mut_state().apply(&mut cmd, screen, con)? {
+ //screen.input_field.display_on(w)?;
+ //self.state().write_flags(w, screen, con)?;
+ let mut error: Option<String> = None;
+ let cmd_result = self.mut_state().apply(&mut cmd, screen, con)?;
+ match cmd_result {
AppStateCmdResult::Quit => {
debug!("cmd result quit");
self.quitting = true;
@@ -193,7 +192,6 @@ impl App {
AppStateCmdResult::NewState(boxed_state, new_cmd) => {
self.push(boxed_state);
cmd = new_cmd;
- self.state().write_status(w, screen, &cmd, con)?;
}
AppStateCmdResult::RefreshState => {
file_sizes::clear_cache();
@@ -206,7 +204,6 @@ impl App {
} else {
self.states.pop();
cmd = self.mut_state().refresh(screen, con);
- self.state().write_status(w, screen, &cmd, con)?;
}
}
AppStateCmdResult::PopStateAndReapply => {
@@ -220,14 +217,17 @@ impl App {
}
}
AppStateCmdResult::DisplayError(txt) => {
- screen.write_status_err(w, &txt)?;
- }
- AppStateCmdResult::Keep => {
- self.state().write_status(w, screen, &cmd, con)?;
+ error = Some(txt.clone());
}
+ _ => {}
}
- screen.input_field.set_content(&cmd.raw);
self.mut_state().display(w, screen, con)?;
+ screen.write_spinner(w, false)?;
+ match error {
+ Some(text) => screen.write_status_err(w, &text)?,
+ None => self.state().write_status(w, screen, &cmd, con)?,
+ }
+ screen.input_field.set_content(&cmd.raw);
screen.input_field.display_on(w)?;
self.state().write_flags(w, screen, con)?;
Ok(cmd)
@@ -280,7 +280,6 @@ impl App {
// if some commands were passed to the application
// we execute them before even starting listening for events
if let Some(unparsed_commands) = &con.launch_args.commands {
- debug!("some commands to apply");
let commands = parse_command_sequence(unparsed_commands, con)?;
for arg_cmd in &commands {
cmd = (*arg_cmd).clone();
diff --git a/src/cli.rs b/src/cli.rs
index 435dda2..28f5b43 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -2,7 +2,10 @@
/// the arguments passed on launch of the application.
use std::{env, path::PathBuf, result::Result};
-use crossterm::Color;
+use crossterm::{
+ input::input,
+ style::Color,
+};
use termimad::{Alignment, MadSkin};
use crate::{
@@ -171,7 +174,7 @@ pub fn read_launch_args() -> Result<AppLaunchArgs, ProgramError> {
/// wait for user input, return `true` if she
/// didn't answer 'n'
pub fn ask_authorization() -> Result<bool, ProgramError> {
- let answer = crossterm::input().read_line()?;
+ let answer = input().read_line()?;
Ok(match answer.as_ref() {
"n" | "N" => false,
_ => true,
diff --git a/src/commands.rs b/src/commands.rs
index be7f828..b408e3b 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -2,7 +2,7 @@
//! in the input. It's independant of the state of the application
//! (verbs arent checked at this point)
-use crossterm::KeyEvent;
+use crossterm::input::KeyEvent;
use regex::Regex;
use termimad::{Event, InputField};
diff --git a/src/conf.rs b/src/conf.rs
index fdf3e03..d2ba09e 100644
--- a/src/conf.rs
+++ b/src/conf.rs
@@ -8,8 +8,8 @@ use std::{
result::Result,
};
-use crossterm::{Attribute};
-use termimad::{CompoundStyle};
+use crossterm::style::Attribute;
+use termimad::CompoundStyle;
use directories::ProjectDirs;
use toml::{self, Value};
diff --git a/src/displayable_tree.rs b/src/displayable_tree.rs
index 194e7b0..f05df48 100644
--- a/src/displayable_tree.rs
+++ b/src/displayable_tree.rs
@@ -5,11 +5,9 @@ use std::os::unix::fs::MetadataExt;
use chrono::{offset::Local, DateTime};
use crossterm::{
- Color,
- Output,
cursor,
queue,
- SetBg,
+ style::{Color, SetBackgroundColor},
terminal::{Clear, ClearType},
};
use termimad::{
@@ -237,7 +235,7 @@ impl<'s, 't> DisplayableTree<'s, 't> {
}
if self.in_app {
queue!(f, Clear(ClearType::UntilNewLine))?;
- queue!(f, SetBg(Color::Reset))?; // to end selection background
+ queue!(f, SetBackgroundColor(Color::Reset))?; // to end selection background
if let Some((sctop, scbottom)) = scrollbar {
queue!(f, cursor::MoveTo(self.area.width, y))?;
let style = if sctop <= y && y <= scbottom {
@@ -248,7 +246,7 @@ impl<'s, 't> DisplayableTree<'s, 't> {
style.queue_str(f, "▐")?;
}
}
- queue!(f, Output("\r\n".to_string()))?;
+ write!(f, "\r\n")?;
}
Ok(())
}
diff --git a/src/flat_tree.rs b/src/flat_tree.rs
index a5e0e1d..4627618 100644
--- a/src/flat_tree.rs
+++ b/src/flat_tree.rs
@@ -8,13 +8,14 @@ use std::{
};
#[cfg(unix)]
-use std::os::unix::fs::MetadataExt;
+use {
+ std::os::unix::fs::MetadataExt,
+ umask::Mode,
+};
#[cfg(windows)]
use is_executable::IsExecutable;
-use umask::Mode;
-
use crate::{
errors,
file_sizes::Size,
@@ -173,9 +174,9 @@ impl Tree {
Ok(())
}
- // do what must be done after line additions or removals:
- // - sort the lines
- // - compute left branchs
+ /// do what must be done after line additions or removals:
+ /// - sort the lines
+ /// - compute left branchs
pub fn after_lines_changed(&mut self) {
// we sort the lines (this is mandatory to avoid crashes)
self.lines[1..].sort();
@@ -245,6 +246,9 @@ impl Tree {
let line = &self.lines[line_index];
depth < usize::from(line.depth) && line.left_branchs[depth]
}
+ /// select another line
+ ///
+ /// For example the following one if dy is 1.
pub fn move_selection(&mut self, dy: i32, page_height: i32) {
// only work for +1 or -1
let l = self.lines.len();
@@ -427,6 +431,7 @@ impl Tree {
bsize.cmp(&asize)
});
}
+ /// compute and return the size of the root
pub fn total_size(&self) -> Size {
if let Some(size) = self.lines[0].size {
// if the real total size is computed, it's in the root line
diff --git a/src/help_content.rs b/src/help_content.rs
index 0b5ee84..0f9f822 100644
--- a/src/help_content.rs
+++ b/src/help_content.rs
@@ -1,4 +1,4 @@
-use crossterm::KeyEvent::*;
+use crossterm::input::KeyEvent::*;
use crate::{
app_context::AppContext,
diff --git a/src/help_states.rs b/src/help_states.rs
index c0d4497..01020b7 100644
--- a/src/help_states.rs
+++ b/src/help_states.rs
@@ -16,16 +16,19 @@ use crate::{
/// an application state dedicated to help
pub struct HelpState {
+ dirty: bool, // when the screen background must be cleared
pub view: MadView,
}
impl HelpState {
pub fn new(screen: &Screen, con: &AppContext) -> HelpState {
let area = Area::uninitialized(); // will be fixed at drawing time
- //Terminal::new().clear(ClearType::All).unwrap(); // FIXME
let markdown = help_content::build_markdown(con);
let view = MadView::from(markdown, area, screen.skin.to_mad_skin());
- HelpState { view }
+ HelpState {
+ dirty: true,
+ view,
+ }
}
fn resize_area(&mut self, screen: &Screen) {
@@ -80,8 +83,13 @@ impl AppState for HelpState {
w: &mut W,
screen: &Screen,
_con: &AppContext
- ) -> Result<(), ProgramError>
- {
+ ) -> Result<(), ProgramError> {
+ if self.dirty {
+ // we don't clear the whole screen more than necessary because
+ // it makes scrolling flicker
+ screen.clear(w)?;
+ self.dirty = false;
+ }
self.resize_area(screen);
Ok(self.view.write_on(w)?)
}
@@ -92,8 +100,7 @@ impl AppState for HelpState {
screen: &mut Screen,
cmd: &Command,
con: &AppContext,
- ) -> Result<(), ProgramError>
- {
+ ) -> Result<(), ProgramError> {
match &cmd.action {
Action::VerbEdit(invocation) => match con.verb_store.search(&invocation.key) {
PrefixSearchResult::NoMatch => screen.write_status_err(w, "No matching verb"),
@@ -129,8 +136,7 @@ impl AppState for HelpState {
_w: &mut W,
_screen: &mut Screen,
_con: &AppContext
- ) -> Result<(), ProgramError>
- {
+ ) -> Result<(), ProgramError> {
Ok(())
}
}
diff --git a/src/screens.rs b/src/screens.rs
index 3e6ab6e..c4bb56b 100644
--- a/src/screens.rs
+++ b/src/screens.rs
@@ -53,7 +53,6 @@ impl Screen {
self.clear_line(w)
}
/// move the cursor to x,y
- ///
pub fn goto(
&self,
w: &mut W,
@@ -63,6 +62,12 @@ impl Screen {
queue!(w, cursor::MoveTo(x, y))?;
Ok(())
}
+ /// clear the whole screen
+ pub fn clear(&self, w: &mut W) -> Result<(), ProgramError> {
+ queue!(w, Clear(ClearType::All))?;
+ Ok(())
+ }
+ /// clear from the cursor to the end of line
pub fn clear_line(&self, w: &mut W) -> Result<(), ProgramError> {
queue!(w, Clear(ClearType::UntilNewLine))?;
Ok(())
diff --git a/src/skin.rs b/src/skin.rs
index 8dd8518..e361ad3 100644
--- a/src/skin.rs
+++ b/src/skin.rs
@@ -4,10 +4,12 @@
use std::{collections::HashMap, fmt, io::Write};
use crossterm::{
- Attribute::*,
- Color::AnsiValue,
- Color::{self, *},
- ResetColor,
+ style::{
+ Attribute::*,
+ Color::AnsiValue,
+ Color::{self, *},
+ ResetColor,
+ },
queue,
};
use termimad::{Alignment, CompoundStyle, LineStyle, MadSkin};
@@ -25,13 +27,13 @@ macro_rules! Skin {
$(pub $name: CompoundStyle,)*
}
impl Skin {
- // build a skin without any terminal control character (for file output)
+ /// build a skin without any terminal control character (for file output)
pub fn no_term() -> Skin {
Skin {
$($name: CompoundStyle::default(),)*
}
}
- // build a skin with some entry overloaded by configuration
+ /// build a skin with some entry overloaded by configuration
pub fn create(mut skin_conf: HashMap<String, CompoundStyle>) -> Skin {
Skin {
$($name: skin_conf.remove(stringify!($name)).unwrap_or(CompoundStyle::new(
@@ -122,7 +124,7 @@ impl Skin {
}
}
-pub fn reset(w: &mut W) -> Result<(), ProgramError> where W: std::io::Write {
+pub fn reset(w: &mut W) -> Result<(), ProgramError> {
queue!(w, ResetColor)?;
Ok(())
}
diff --git a/src/skin_conf.rs b/src/skin_conf.rs
index c7c4841..c54aefc 100644
--- a/src/skin_conf.rs
+++ b/src/skin_conf.rs
@@ -5,7 +5,7 @@ use regex::Regex;
///
use std::result::Result;
-use crossterm::{
+use crossterm::style::{
Attribute::{self, *},
Color::{self, *},
};
diff --git a/src/verb_conf.rs b/src/verb_conf.rs
index 6a3907a..03002d3 100644
--- a/src/verb_conf.rs
+++ b/src/verb_conf.rs
@@ -1,4 +1,4 @@
-use crossterm::KeyEvent;
+use crossterm::input::KeyEvent;
use regex::Regex;
use crate::errors::ConfError;
@@ -78,7 +78,7 @@ pub fn parse_key(raw: &str) -> Result<KeyEvent, ConfError> {
#[cfg(test)]
mod key_parsing_tests {
- use crossterm::KeyEvent::*;
+ use crossterm::input::KeyEvent::*;
use crate::verb_conf::*;
diff --git a/src/verb_store.rs b/src/verb_store.rs
index 7b542f3..2f6c423 100644
--- a/src/verb_store.rs
+++ b/src/verb_store.rs
@@ -1,4 +1,4 @@
-use crossterm::KeyEvent;
+use crossterm::input::KeyEvent;
use crate::{conf::Conf, permissions, verbs::Verb};
diff --git a/src/verbs.rs b/src/verbs.rs
index 9f8f5f8..7d37597 100644
--- a/src/verbs.rs
+++ b/src/verbs.rs
@@ -8,7 +8,7 @@ use std::{
path::{Path, PathBuf},
};
-use crossterm::KeyEvent;
+use crossterm::input::KeyEvent;
use regex::{self, Captures, Regex};
use crate::{
diff --git a/website/docs/documentation/usage.md b/website/docs/documentation/usage.md
index 7d2788e..721c83d 100644
--- a/website/docs/documentation/usage.md
+++ b/website/docs/documentation/usage.md
@@ -15,6 +15,12 @@ You can pass as argument the path you want to see, for example
br ~
+Broot renders on `stderr` and can be ran in a subshell, which means you can also (on unix) do things like
+
+ my_unix_command "$(broot some_dir)"
+
+and quit broot with `:pp` on the selected path. But most often you'll more conveniently simply add your command (and maybe a shorcut) to the [config file](configuration.md#verbs).
+
# Navigate
## Basics
@@ -89,12 +95,13 @@ This behavior is tuned with several toggles.
To apply one, just type a space (or `:`), then the start of its shortcut, then hit <kbd class=b>⏎</kbd>.
-For example typing `:s` then enter will show directory sizes:
+For example typing `:s` then enter will show file and directory sizes:
-![dev sizes](../img/20190305-dev-sizes.png)
+![dev sizes](../img/20191030-dev-sizes.png)
-You may notice a scrollbar on this screenshot.
-You may sometimes want to *not* trim the first level of the tree, which is done by using the `toggle_trim_root` (and which is also automatically done when displaying sizes).
+You may notice a scrollbar on this screenshot. The first level of the tree is always uncut when you display sizes (you're in a special "whale hunt" mode).
+
+Not trimming the root is also possible in normal mode by using the `toggle_trim_root` toggle.
## gitignore
@@ -106,6 +113,8 @@ no | `gi:n` | .gitignore files aren't applied
yes | `gi:y` | .gitignore rules are applied whenever they're found. If the root contains several git projects, it means different visible subtrees follow different sets of rules
auto| `gi:a` | if the current root is a git directory or inside one, then the rules are applied. Otherwise they aren't
+*You don't really have to remember the meaning of those three mode: you may just do `:gi` to show or hide the git ignored files as desired.*
+
## Quitting broot
Other than executing a command leaving broot, there are several ways to quit:
@@ -274,12 +283,6 @@ It can be used in several ways.
The easiest is to just execute it from inside the application (the verb is also accessible with the `:pt` shortcut). This quits broot and you find the tree on your console, without the status line and the input, but with the same filtering state as when you were browsing.
-With the `--out` command, the tree is written in a passed file. For example `br --out test.txt`.
-
-!!! Note
- It's not possible today to simply redirect the output of broot into a file with `>>>`.
-
-You don't have to enter broot, you may also directly get the tree by using the [`--cmd` argument](#cmd). An additional parameter may come handy: `--height` which specifies the size of the virtual screen, which may be smaller or bigger than the real one (no problem if you want 10000 lines).
Example with a filter:
@@ -291,4 +294,21 @@ Example without style or color, thanks to `--no-style`:
This is also how would look the tree directly exported into a file.
+With the `--out` command, the tree is written in a given file. For example `br --out test.txt`.
+
+You can also redirect the output of broot in a standard unix way.
+
+You don't have to enter broot, you may also directly get the tree by using the [`--cmd` argument](#cmd). An additional parameter may come handy: `--height` which specifies the size of the virtual screen, which may be smaller or bigger than the real one (no problem if you want 10000 lines).
+
+For example
+
+ broot --cmd ":pt" --no-style > my_file.txt
+
+will export the local tree to the `my_file.txt` file.
+
+Or just
+
+ broot --no-style > tree.txt
+
+in which case you'll manually do `:pt` when in broot but after having had the opportunity to navigate, filter and change toggles as desired.
diff --git a/website/docs/img/20191030-dev-sizes.png b/website/docs/img/20191030-dev-sizes.png
new file mode 100644
index 0000000..06f2bd8
--- /dev/null
+++ b/website/docs/img/20191030-dev-sizes.png
Binary files differ