tms/
lib.rs

1pub mod cli;
2pub mod configs;
3pub mod dirty_paths;
4pub mod error;
5pub mod keymap;
6pub mod picker;
7pub mod repos;
8pub mod session;
9pub mod tmux;
10
11use configs::Config;
12use std::process;
13
14use crate::{
15    error::{Result, TmsError},
16    picker::{Picker, Preview},
17    tmux::Tmux,
18};
19
20pub fn execute_command(command: &str, args: Vec<String>) -> process::Output {
21    process::Command::new(command)
22        .args(args)
23        .stdin(process::Stdio::inherit())
24        .output()
25        .unwrap_or_else(|_| panic!("Failed to execute command `{command}`"))
26}
27
28pub fn get_single_selection(
29    list: &[String],
30    preview: Preview,
31    config: &Config,
32    tmux: &Tmux,
33) -> Result<Option<String>> {
34    let mut picker = Picker::new(list, preview, config.shortcuts.as_ref(), tmux)
35        .set_colors(config.picker_colors.as_ref());
36
37    picker.run()
38}