mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 12:23:46 +03:00
wezterm cli: add send-text --no-paste option
refs: https://github.com/wez/wezterm/issues/888#issuecomment-1123462175
This commit is contained in:
parent
8cce462780
commit
385f3c99d3
@ -38,7 +38,7 @@ As features stabilize some brief notes about them will accumulate here.
|
|||||||
* [SplitPane](config/lua/keyassignment/SplitPane.md) key assignment that allows specifying the size and location of the split, as well as top-level (full width/height) splits. `wezterm cli split-pane --help` shows equivalent options you can use from the cli. [#578](https://github.com/wez/wezterm/issues/578)
|
* [SplitPane](config/lua/keyassignment/SplitPane.md) key assignment that allows specifying the size and location of the split, as well as top-level (full width/height) splits. `wezterm cli split-pane --help` shows equivalent options you can use from the cli. [#578](https://github.com/wez/wezterm/issues/578)
|
||||||
* [ime_preedit_rendering](config/lua/config/ime_preedit_rendering.md) option to choose whether to use the builtin or the system IME preedit rendering mode. Thanks to [@kumattau](https://github.com/kumattau)! [#2006](https://github.com/wez/wezterm/pull/2006)
|
* [ime_preedit_rendering](config/lua/config/ime_preedit_rendering.md) option to choose whether to use the builtin or the system IME preedit rendering mode. Thanks to [@kumattau](https://github.com/kumattau)! [#2006](https://github.com/wez/wezterm/pull/2006)
|
||||||
* [wezterm.strftime_utc](config/lua/wezterm/strftime_utc.md) for manipulating times in UTC rather than the local timezone
|
* [wezterm.strftime_utc](config/lua/wezterm/strftime_utc.md) for manipulating times in UTC rather than the local timezone
|
||||||
|
* `wezterm cli send-text --no-paste` option to send text to a pain without wrapping it as a bracketed paste
|
||||||
|
|
||||||
#### Updated
|
#### Updated
|
||||||
* Bundled harfbuzz to 4.3.0
|
* Bundled harfbuzz to 4.3.0
|
||||||
|
@ -266,14 +266,18 @@ Outputs the pane-id for the newly created pane on success"
|
|||||||
/// Send text to a pane as though it were pasted.
|
/// Send text to a pane as though it were pasted.
|
||||||
/// If bracketed paste mode is enabled in the pane, then the
|
/// If bracketed paste mode is enabled in the pane, then the
|
||||||
/// text will be sent as a bracketed paste.
|
/// text will be sent as a bracketed paste.
|
||||||
#[structopt(name = "send-text")]
|
#[structopt(name = "send-text", rename_all = "kebab")]
|
||||||
SendText {
|
SendText {
|
||||||
/// Specify the target pane.
|
/// Specify the target pane.
|
||||||
/// The default is to use the current pane based on the
|
/// The default is to use the current pane based on the
|
||||||
/// environment variable WEZTERM_PANE.
|
/// environment variable WEZTERM_PANE.
|
||||||
#[structopt(long = "pane-id")]
|
#[structopt(long)]
|
||||||
pane_id: Option<PaneId>,
|
pane_id: Option<PaneId>,
|
||||||
|
|
||||||
|
/// Send the text directly, rather than as a bracketed paste.
|
||||||
|
#[structopt(long)]
|
||||||
|
no_paste: bool,
|
||||||
|
|
||||||
/// The text to send. If omitted, will read the text from stdin.
|
/// The text to send. If omitted, will read the text from stdin.
|
||||||
text: Option<String>,
|
text: Option<String>,
|
||||||
},
|
},
|
||||||
@ -825,7 +829,11 @@ async fn run_cli_async(config: config::ConfigHandle, cli: CliCommand) -> anyhow:
|
|||||||
log::debug!("{:?}", spawned);
|
log::debug!("{:?}", spawned);
|
||||||
println!("{}", spawned.pane_id);
|
println!("{}", spawned.pane_id);
|
||||||
}
|
}
|
||||||
CliSubCommand::SendText { pane_id, text } => {
|
CliSubCommand::SendText {
|
||||||
|
pane_id,
|
||||||
|
text,
|
||||||
|
no_paste,
|
||||||
|
} => {
|
||||||
let pane_id = resolve_pane_id(&client, pane_id).await?;
|
let pane_id = resolve_pane_id(&client, pane_id).await?;
|
||||||
|
|
||||||
let data = match text {
|
let data = match text {
|
||||||
@ -839,9 +847,18 @@ async fn run_cli_async(config: config::ConfigHandle, cli: CliCommand) -> anyhow:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
client
|
if no_paste {
|
||||||
.send_paste(codec::SendPaste { pane_id, data })
|
client
|
||||||
.await?;
|
.write_to_pane(codec::WriteToPane {
|
||||||
|
pane_id,
|
||||||
|
data: data.as_bytes().to_vec(),
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
} else {
|
||||||
|
client
|
||||||
|
.send_paste(codec::SendPaste { pane_id, data })
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CliSubCommand::SpawnCommand {
|
CliSubCommand::SpawnCommand {
|
||||||
cwd,
|
cwd,
|
||||||
|
Loading…
Reference in New Issue
Block a user