Compare commits

..

No commits in common. "65e28327f113b55b592397f405046ad879ed712e" and "044736b535ac7209c51935f41d9d6d70cf0223d2" have entirely different histories.

3 changed files with 4 additions and 27 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "remux" name = "remux"
version = "0.1.1" version = "0.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -30,9 +30,3 @@ pub fn missing_target() {
exit(4); exit(4);
} }
/// user declined nesting dialog
pub fn nest_declined() {
println!("remux: session nesting declined by user");
exit(5);
}

View file

@ -1,10 +1,5 @@
use std::{ use std::{
env::{ set_var, var }, env::var,
io::{
self,
Read, Write
},
process::exit process::exit
}; };
@ -13,8 +8,6 @@ use tmux_interface::{
variables::session::session::SESSION_ALL variables::session::session::SESSION_ALL
}; };
use crate::error;
/// return a Vec of all sessions or None /// return a Vec of all sessions or None
pub fn get_sessions() -> Option<Vec<Session>> { pub fn get_sessions() -> Option<Vec<Session>> {
let i_sessions = Sessions::get(SESSION_ALL); let i_sessions = Sessions::get(SESSION_ALL);
@ -29,18 +22,8 @@ pub fn get_sessions() -> Option<Vec<Session>> {
pub fn prevent_nest() { pub fn prevent_nest() {
let tmux = var("TMUX").ok(); let tmux = var("TMUX").ok();
if tmux.is_some() && tmux.unwrap() != "" { if tmux.is_some() && tmux.unwrap() != "" {
// ask the user if they want to nest (default: no) println!("Sessions should be nested with care; unset TMUX to allow.");
print!("Are you sure you want to nest sessions? (y/N) "); exit(1);
let _ = io::stdout().flush();
let mut input = [0];
let _ = io::stdin().read(&mut input);
match input[0] as char {
'y' | 'Y'
=> {},
_ => error::nest_declined()
}
set_var("TMUX", "");
} }
} }