mirror of
https://github.com/wez/wezterm.git
synced 2024-12-18 02:42:05 +03:00
add useless mux server mode
This commit is contained in:
parent
e3fa12ee41
commit
4c322e1c69
31
src/main.rs
31
src/main.rs
@ -101,17 +101,14 @@ struct Opt {
|
|||||||
/// as if it were a login shell.
|
/// as if it were a login shell.
|
||||||
#[structopt(parse(from_os_str))]
|
#[structopt(parse(from_os_str))]
|
||||||
prog: Vec<OsString>,
|
prog: Vec<OsString>,
|
||||||
|
|
||||||
|
/// Rather than running the terminal, run as the
|
||||||
|
/// multiplexer server.
|
||||||
|
#[structopt(long = "start-mux-server")]
|
||||||
|
start_mux_server: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Error> {
|
fn run_terminal_gui(config: Arc<config::Config>, opts: Opt) -> Result<(), Error> {
|
||||||
let opts = Opt::from_args();
|
|
||||||
let config = Arc::new(if opts.skip_config {
|
|
||||||
config::Config::default_config()
|
|
||||||
} else {
|
|
||||||
config::Config::load()?
|
|
||||||
});
|
|
||||||
println!("Using configuration: {:#?}\nopts: {:#?}", config, opts);
|
|
||||||
|
|
||||||
let font_system = opts.font_system.unwrap_or(config.font_system);
|
let font_system = opts.font_system.unwrap_or(config.font_system);
|
||||||
font_system.set_default();
|
font_system.set_default();
|
||||||
|
|
||||||
@ -133,6 +130,22 @@ fn main() -> Result<(), Error> {
|
|||||||
gui.run_forever()
|
gui.run_forever()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn main() -> Result<(), Error> {
|
||||||
|
let opts = Opt::from_args();
|
||||||
|
let config = Arc::new(if opts.skip_config {
|
||||||
|
config::Config::default_config()
|
||||||
|
} else {
|
||||||
|
config::Config::load()?
|
||||||
|
});
|
||||||
|
println!("Using configuration: {:#?}\nopts: {:#?}", config, opts);
|
||||||
|
|
||||||
|
if opts.start_mux_server {
|
||||||
|
server::listener::run_mux_server(config)
|
||||||
|
} else {
|
||||||
|
run_terminal_gui(config, opts)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn spawn_tab(
|
fn spawn_tab(
|
||||||
config: &Arc<config::Config>,
|
config: &Arc<config::Config>,
|
||||||
cmd: Option<Vec<&std::ffi::OsStr>>,
|
cmd: Option<Vec<&std::ffi::OsStr>>,
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
|
use crate::config::Config;
|
||||||
|
use crate::mux::Mux;
|
||||||
use crate::server::{UnixListener, UnixStream};
|
use crate::server::{UnixListener, UnixStream};
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
use std::rc::Rc;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub trait SocketLike: Read + Write + Send {}
|
pub trait SocketLike: Read + Write + Send {}
|
||||||
|
|
||||||
@ -31,3 +35,10 @@ impl Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct ClientSession {}
|
pub struct ClientSession {}
|
||||||
|
|
||||||
|
pub fn run_mux_server(config: Arc<Config>) -> Result<(), Error> {
|
||||||
|
let mux = Rc::new(Mux::default());
|
||||||
|
Mux::set_mux(&mux);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user