Compare commits
2 commits
222f929fd4
...
a915bfd9c5
Author | SHA1 | Date | |
---|---|---|---|
a915bfd9c5 | |||
ac97336f13 |
5 changed files with 21 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "remux"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
edition = "2021"
|
||||
authors = [ "Valerie Wolfe <sleeplessval@gmail.com>" ]
|
||||
description = "A friendly command shortener for tmux"
|
||||
|
|
|
@ -23,7 +23,6 @@ remux n foo
|
|||
# list sessions
|
||||
tmux ls
|
||||
remux l
|
||||
remux
|
||||
|
||||
# attach
|
||||
tmux a -t foo
|
||||
|
|
|
@ -64,6 +64,23 @@ pub fn attach(pargs: &mut Arguments) {
|
|||
tmux.output().ok();
|
||||
}
|
||||
|
||||
pub fn context_action() {
|
||||
let repo = util::repo_root(std::env::current_dir().unwrap());
|
||||
if !env::tmux() && repo.is_some() {
|
||||
let target = util::repo_fallback();
|
||||
let mut args = Arguments::from_vec( vec![(&target).into()] );
|
||||
if util::session_exists(&target) {
|
||||
attach(&mut args);
|
||||
} else {
|
||||
new(&mut args);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
// fallback behavior is list
|
||||
list();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn detach(pargs: &mut Arguments) {
|
||||
util::terminal_enforce();
|
||||
// get target or fallback
|
||||
|
|
|
@ -13,7 +13,7 @@ println!("remux v{VERSION}
|
|||
Valerie Wolfe <sleeplessval@gmail.com>
|
||||
A command wrapper for tmux written in Rust.
|
||||
|
||||
usage: remux <command> [<args>]
|
||||
usage: remux [command] [<args>]
|
||||
|
||||
commands:
|
||||
help Show help text for remux, a command, or a help topic.
|
||||
|
|
|
@ -43,6 +43,8 @@ fn main() {
|
|||
match subcommand.as_deref() {
|
||||
Some("help")
|
||||
=> help(&mut args),
|
||||
None
|
||||
=> command::share::context_action(),
|
||||
|
||||
Some("a" | "attach")
|
||||
=> command::share::attach(&mut args),
|
||||
|
@ -53,7 +55,6 @@ fn main() {
|
|||
Some("h" | "has")
|
||||
=> command::share::has(&mut args),
|
||||
|
||||
None |
|
||||
Some("l" | "ls" | "list")
|
||||
=> command::share::list(),
|
||||
|
||||
|
|
Loading…
Reference in a new issue