diff --git a/docs/examples/cmd-synopsis-wezterm--help.txt b/docs/examples/cmd-synopsis-wezterm--help.txt index 190b77049..121e9181e 100644 --- a/docs/examples/cmd-synopsis-wezterm--help.txt +++ b/docs/examples/cmd-synopsis-wezterm--help.txt @@ -5,7 +5,7 @@ Usage: wezterm [OPTIONS] [COMMAND] Commands: start Start the GUI, optionally running an alternative - program [aliases: -e] + program ssh Establish an ssh session serial Open a serial port connect Connect to wezterm multiplexer diff --git a/wezterm-gui-subcommands/src/lib.rs b/wezterm-gui-subcommands/src/lib.rs index d2e8594ff..c64f2b314 100644 --- a/wezterm-gui-subcommands/src/lib.rs +++ b/wezterm-gui-subcommands/src/lib.rs @@ -26,7 +26,6 @@ pub fn name_equals_value(arg: &str) -> Result<(String, String), String> { #[derive(Debug, Parser, Default, Clone)] #[command(trailing_var_arg = true)] -#[command(visible_short_flag_alias = 'e')] pub struct StartCommand { /// If true, do not connect to domains marked as connect_automatically /// in your wezterm configuration file. diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 42df6476a..6d86005e6 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -110,6 +110,9 @@ enum SubCommand { )] Start(StartCommand), + #[command(short_flag_alias = 'e', hide = true)] + BlockingStart(StartCommand), + #[command(name = "ssh", about = "Establish an ssh session")] Ssh(SshCommand), @@ -1195,6 +1198,16 @@ fn run() -> anyhow::Result<()> { let config = config::configuration(); let sub = match opts.cmd.as_ref().cloned() { + Some(SubCommand::BlockingStart(start)) => { + // Act as if the normal start subcommand was used, + // except that we always start a new instance. + // This is needed for compatibility, because many tools assume + // that "$TERMINAL -e $COMMAND" blocks until the command finished. + SubCommand::Start(StartCommand { + always_new_process: true, + ..start + }) + } Some(sub) => sub, None => { // Need to fake an argv0 @@ -1218,6 +1231,7 @@ fn run() -> anyhow::Result<()> { wezterm_blob_leases::clear_storage(); res } + SubCommand::BlockingStart(_) => unreachable!(), SubCommand::Ssh(ssh) => run_ssh(ssh), SubCommand::Serial(serial) => run_serial(config, serial), SubCommand::Connect(connect) => run_terminal_gui(