Compare commits
No commits in common. "e00c9e5366eafba06ada0019494722ed39dd4d66" and "80a5c0a968e2aa40577340d5cc3fcb7870af7ef2" have entirely different histories.
e00c9e5366
...
80a5c0a968
2 changed files with 13 additions and 25 deletions
|
@ -14,7 +14,7 @@ path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pico-args = { version = "0.5.0", features = [ "combined-flags", "eq-separator" ] }
|
pico-args = { version = "0.5.0", features = [ "combined-flags", "eq-separator" ] }
|
||||||
termion = "3.0.0"
|
termion = "2.0.1"
|
||||||
tmux_interface = "0.3.2"
|
tmux_interface = "0.3.2"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
@ -131,7 +131,7 @@ pub fn list() {
|
||||||
// pretty print session list
|
// pretty print session list
|
||||||
println!("sessions:");
|
println!("sessions:");
|
||||||
for session in sessions.into_iter() {
|
for session in sessions.into_iter() {
|
||||||
let group = session.name.unwrap_or("[untitled]".to_string());
|
let group = session.group.unwrap_or("[untitled]".to_string());
|
||||||
let id = session.id.unwrap();
|
let id = session.id.unwrap();
|
||||||
let attached = session.attached.unwrap_or(0) > 0;
|
let attached = session.attached.unwrap_or(0) > 0;
|
||||||
|
|
||||||
|
@ -173,32 +173,20 @@ pub fn new(pargs: &mut Arguments) {
|
||||||
command = args.get(1);
|
command = args.get(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut tmux = Tmux::new();
|
let mut new = commands::NewSession::new();
|
||||||
|
new = new.group_name(title);
|
||||||
|
if let Some(command) = command { new.shell_command = Some(command.to_string_lossy()); }
|
||||||
|
if detached { new.detached = true; }
|
||||||
|
if let Ok(target_dir) = target_dir { new = new.start_directory(target_dir); }
|
||||||
|
|
||||||
// if no session exists with the given title, create one
|
let mut tmux = Tmux::new().add_command(new);
|
||||||
if !util::session_exists(&title) {
|
|
||||||
let mut new = commands::NewSession::new();
|
|
||||||
new = new.session_name(title);
|
|
||||||
if let Some(command) = command { new.shell_command = Some(command.to_string_lossy()); }
|
|
||||||
if detached { new.detached = true; }
|
|
||||||
if let Ok(target_dir) = target_dir { new = new.start_directory(target_dir); }
|
|
||||||
tmux = tmux.add_command(new).disable_echo();
|
|
||||||
|
|
||||||
// rename window if var not empty
|
// rename window if var not empty
|
||||||
if !window_name.is_empty() {
|
if !window_name.is_empty() {
|
||||||
let auto_name = commands::RenameWindow::new()
|
let auto_name = commands::RenameWindow::new()
|
||||||
.new_name(window_name);
|
.new_name(window_name);
|
||||||
tmux = tmux.add_command(auto_name);
|
tmux = tmux.add_command(auto_name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// otherwise, use the existing session
|
|
||||||
else {
|
|
||||||
let mut attach = commands::AttachSession::new();
|
|
||||||
attach = attach.target_session(title);
|
|
||||||
tmux = tmux.add_command(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tmux.output().ok();
|
tmux.output().ok();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue