diff --git a/README.md b/README.md new file mode 100644 index 0000000..c43ebdc --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# multiview-rs + +*Run many commands and watch all outputs in a single terminal* + + +## Installation + +If rust is not already installed, [install rust](https://www.rust-lang.org/tools/install). + +Then run: + +```sh +cargo install --git https://gitea.tforgione.fr/tforgione/multiview +``` + +## Usage + +Split your terminal in two rows, the first containing three columns, and the second containing one column: +```sh +multiview cmd1 :: cmd2 :: cmd3 // cmd4 :: cmd5 +``` + +Split your terminal in two columns, the first containing three rows, and the second containing one row: +```sh +multiview cmd1 // cmd2 // cmd3 :: cmd4 // cmd5 +``` + +## Colors + +Most well written programs will disable colors when running from multiview, in order to force them to use colors, you +can use the `unbuffer` command from the [`expect` package](https://packages.ubuntu.com/search?keywords=expect). + +```sh +multiview unbuffer cmd1 :: unbuffer cmd2 +``` + +## Shortcuts + + - `k`: kills the current tile + - `K`: kills all tiles + - `r`: restarts the current tile + - `R`: restarts all tiles + - `l`: draw a line on the current tile + - `L`: draw a line on all tiles + - `q`: quits + +## Limitations + +*Don't resize your terminal... just don't* :cry: + +## History + +This is my attempt to rewrite [arjunmehta's multiview](https://github.com/arjunmehta/multiview) in rust. + +Their version has many features that I don't use, but is missing a few things that I need: + - line wrapping: when a line is bigger than the terminal size, the end is just not displayed + - scroll: if your output has more lines than your terminal height, there is no way (to my knowledge) to scroll up + + diff --git a/screenshots/col-major.png b/screenshots/col-major.png new file mode 100644 index 0000000..8742a36 Binary files /dev/null and b/screenshots/col-major.png differ diff --git a/screenshots/row-major.png b/screenshots/row-major.png new file mode 100644 index 0000000..4e41cfa Binary files /dev/null and b/screenshots/row-major.png differ diff --git a/src/lib.rs b/src/lib.rs index 0230216..e19fdea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -359,12 +359,12 @@ pub fn main() -> io::Result<()> { row.into_iter() .map(|((i, j), tile)| { - let (i, j) = if is_row_major { (i, j) } else { (j, i) }; + let (p_i, p_j) = if is_row_major { (i, j) } else { (j, i) }; TileBuilder::new() .command(tile.into()) .coords((i as u16, j as u16)) - .position((j as u16 * tile_size.0 + 1, i as u16 * tile_size.1 + 1)) + .position((p_j as u16 * tile_size.0 + 1, p_i as u16 * tile_size.1 + 1)) .size(tile_size) .sender(sender.clone()) .build()