Add support for distant spawn -c 'cmd str'

pull/218/head
Chip Senkbeil 10 months ago
parent b74cba28df
commit 84ea28402d
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- CLI now supports `-c <STR>` and `--cmd <STR>` to use a given string as the
command as an alternative to `-- <CMD> <ARG> <ARG>`
### Changed
- Cli no longer uses `-c` as shorthand for specifying a config file
## [0.20.0-alpha.10]
### Added

@ -364,6 +364,7 @@ async fn async_run(cmd: ClientSubcommand) -> CliResult {
cache,
connection,
cmd,
cmd_str,
current_dir,
environment,
lsp,
@ -388,7 +389,7 @@ async fn async_run(cmd: ClientSubcommand) -> CliResult {
.with_context(|| format!("Failed to open channel to connection {connection_id}"))?;
// Convert cmd into string
let cmd = cmd.join(" ");
let cmd = cmd_str.unwrap_or_else(|| cmd.join(" "));
if let Some(scheme) = lsp {
debug!(

@ -28,12 +28,8 @@ pub struct Options {
#[clap(flatten)]
pub logging: LoggingSettings,
#[cfg(feature = "tracing")]
#[clap(long, global = true)]
pub tracing: bool,
/// Configuration file to load instead of the default paths
#[clap(short = 'c', long = "config", global = true, value_parser)]
#[clap(long = "config", global = true, value_parser)]
config_path: Option<PathBuf>,
#[clap(subcommand)]
@ -452,8 +448,17 @@ pub enum ClientSubcommand {
#[clap(long, default_value_t)]
environment: Map,
/// If present, commands are read from the provided string
#[clap(short = 'c', long = "cmd", conflicts_with = "CMD")]
cmd_str: Option<String>,
/// Command to run
#[clap(name = "CMD", num_args = 1.., last = true)]
#[clap(
name = "CMD",
num_args = 1..,
last = true,
conflicts_with = "cmd_str"
)]
cmd: Vec<String>,
},
@ -1857,6 +1862,7 @@ mod tests {
environment: map!(),
lsp: Some(None),
pty: true,
cmd_str: None,
cmd: vec![String::from("cmd")],
}),
};
@ -1895,6 +1901,7 @@ mod tests {
environment: map!(),
lsp: Some(None),
pty: true,
cmd_str: None,
cmd: vec![String::from("cmd")],
}),
}
@ -1920,6 +1927,7 @@ mod tests {
environment: map!(),
lsp: Some(None),
pty: true,
cmd_str: None,
cmd: vec![String::from("cmd")],
}),
};
@ -1958,6 +1966,7 @@ mod tests {
environment: map!(),
lsp: Some(None),
pty: true,
cmd_str: None,
cmd: vec![String::from("cmd")],
}),
}

Loading…
Cancel
Save