mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-27 07:03:17 +08:00
docs(cli): say --upload cannot take a command (#4502)
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
This commit is contained in:
@@ -1472,6 +1472,10 @@ enum SandboxCommands {
|
||||
/// Outside a Git work tree, uploads proceed unfiltered with a warning.
|
||||
/// Filtering errors or empty selections stop the upload; use
|
||||
/// `--no-git-ignore` to intentionally upload everything.
|
||||
///
|
||||
/// Cannot be combined with a trailing command, because uploads finish
|
||||
/// after the main process starts. Create the sandbox without a command,
|
||||
/// then run the workload with `sandbox exec`.
|
||||
#[arg(
|
||||
long,
|
||||
value_hint = ValueHint::AnyPath,
|
||||
@@ -4878,6 +4882,35 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sandbox_create_upload_conflicts_with_command_and_help_says_so() {
|
||||
let err = Cli::try_parse_from([
|
||||
"openshell",
|
||||
"sandbox",
|
||||
"create",
|
||||
"--upload",
|
||||
".",
|
||||
"--",
|
||||
"true",
|
||||
])
|
||||
.expect_err("--upload with a trailing command should be rejected");
|
||||
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
|
||||
|
||||
let cmd = Cli::command();
|
||||
let create = cmd
|
||||
.find_subcommand("sandbox")
|
||||
.and_then(|c| c.find_subcommand("create"))
|
||||
.expect("missing sandbox create subcommand");
|
||||
let help = create
|
||||
.get_arguments()
|
||||
.find(|a| a.get_id() == "upload")
|
||||
.and_then(|a| a.get_long_help())
|
||||
.expect("--upload has long help")
|
||||
.to_string();
|
||||
assert!(help.contains("Cannot be combined with a trailing command"));
|
||||
assert!(help.contains("sandbox exec"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sandbox_create_no_git_ignore_requires_upload() {
|
||||
let result = Cli::try_parse_from(["openshell", "sandbox", "create", "--no-git-ignore"]);
|
||||
|
||||
Reference in New Issue
Block a user