Compare commits

..

2 commits

Author SHA1 Message Date
be593c82e7 list attach symbol is now configurable 2024-03-06 16:12:54 -05:00
9c814c43f4 updated README 2024-03-06 16:05:53 -05:00
2 changed files with 15 additions and 7 deletions

View file

@ -7,6 +7,10 @@ A tmux wrapper and command shortener written in Rust. ReMux's
goal is to wrap tmux commands to be both shorter, and oriented goal is to wrap tmux commands to be both shorter, and oriented
around session names instead of session IDs. around session names instead of session IDs.
To further simplify developer usage, the `attach`, `detach`, `has`, and `new`
commands can be used without a target field, and will default to the name of
the Git repository root directory, if one is found.
In their shortest forms, *every* ReMux command is as short or In their shortest forms, *every* ReMux command is as short or
shorter than its equivalent tmux command: shorter than its equivalent tmux command:
@ -41,10 +45,6 @@ remux n -n foo
``` ```
If you're working in a git repository, the `attach`, `detach`, `has`, and `new`
commands can be used without a session title, and the repository directory name
will be used instead.
## Dependencies ## Dependencies
ReMux depends on [tmux](https://github.com/tmux/tmux). ReMux depends on [tmux](https://github.com/tmux/tmux).
@ -85,6 +85,10 @@ using an AUR package manager such as <a href="https://github.com/Morganamilo/par
Install the package using Cargo with the command <code>cargo install tmux-remux</code>. Install the package using Cargo with the command <code>cargo install tmux-remux</code>.
</details> </details>
## Configuration
The pretty-print attached symbol (default: `*`) can be set manually by setting `REMUX_ATTACH_SYMBOL`.
## Libraries ## Libraries
- [pico-args](https://crates.io/crates/pico_args) — argument parsing - [pico-args](https://crates.io/crates/pico_args) — argument parsing

View file

@ -1,5 +1,6 @@
//! globally available tmux commands. //! globally available tmux commands.
use std::{ use std::{
env::var,
ffi::OsString, ffi::OsString,
process::exit process::exit
}; };
@ -117,6 +118,9 @@ pub fn list() {
return; return;
} }
// get attached session symbol
let attach_symbol = var("REMUX_ATTACH_SYMBOL").unwrap_or("*".to_string());
// pretty print session list // pretty print session list
println!("sessions:"); println!("sessions:");
for session in sessions.into_iter() { for session in sessions.into_iter() {
@ -125,9 +129,9 @@ pub fn list() {
let attached = session.attached.unwrap_or(0) > 0; let attached = session.attached.unwrap_or(0) > 0;
println!( println!(
" {group} ({bold}{blue}{id}{reset}) {bold}{green}{attach_sym}{reset}", " {group} ({bold}{blue}{id}{reset}) {bold}{green}{attach}{reset}",
// value // values
attach_sym = if attached { "\u{F0339}" } else { "" }, attach = if attached { attach_symbol.clone() } else { "".to_string() },
// formatting // formatting
bold = style::Bold, bold = style::Bold,
blue = color::Fg(color::Blue), blue = color::Fg(color::Blue),