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
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
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
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>.
</details>
## Configuration
The pretty-print attached symbol (default: `*`) can be set manually by setting `REMUX_ATTACH_SYMBOL`.
## Libraries
- [pico-args](https://crates.io/crates/pico_args) — argument parsing

View file

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