Alexandre Pasmantier 67677fb917
refactor!: all channels are now cable channels (#479)
- tv's default channel (when lauching `tv`) is now configurable via the
`default_channel` configuration option
- add `RUST_BACKTRACE=1` and `--nocapture` to ci testing for better
debugging
- remove all builtin channels and associated glue code as well as the
`ToCliChannel` and `ToUnitChannel` derive macros
- recode all builtin channels using shell commands (along with `fd`,
`bat`, and `rg`)
- add support for interactive shell commands inside cable channels
- drop the `send_to_channel` feature until further notice (will be
reimplemented later on in a more generic and customizable way)
2025-04-27 23:50:14 +02:00

30 lines
568 B
Rust

use std::process::Command;
#[cfg(not(unix))]
use tracing::warn;
use super::shell::Shell;
pub fn shell_command(interactive: bool) -> Command {
let shell = Shell::from_env().unwrap_or_default();
let mut cmd = Command::new(shell.executable());
cmd.arg(match shell {
Shell::PowerShell => "-Command",
Shell::Cmd => "/C",
_ => "-c",
});
#[cfg(unix)]
if interactive {
cmd.arg("-i");
}
#[cfg(not(unix))]
if interactive {
warn!("Interactive mode is not supported on Windows.");
}
cmd
}