fix: keep product help target independent

This commit is contained in:
2026-08-30 20:57:16 +09:00
parent 928ff0eabe
commit 733632509a
2 changed files with 19 additions and 7 deletions
+11 -3
View File
@@ -118,6 +118,9 @@ pub fn run(
cli: ObjectiveCli, cli: ObjectiveCli,
target: ResolvedTarget, target: ResolvedTarget,
) -> Result<ObjectiveCliOutput, ObjectiveCliError> { ) -> Result<ObjectiveCliOutput, ObjectiveCliError> {
if cli == ObjectiveCli::Help {
return Ok(success(help_text().to_string()));
}
match target { match target {
ResolvedTarget::Standalone => Err(ObjectiveCliError::new( ResolvedTarget::Standalone => Err(ObjectiveCliError::new(
"Standalone is a one-shot Worker host, not Objective storage authority; select a Backend target", "Standalone is a one-shot Worker host, not Objective storage authority; select a Backend target",
@@ -359,8 +362,13 @@ mod tests {
} }
#[test] #[test]
fn help_states_backend_authority() { fn help_is_available_without_objective_storage_authority() {
assert!(help_text().contains("require the Workspace-scoped Backend")); let output = run(ObjectiveCli::Help, ResolvedTarget::Standalone).unwrap();
assert!(!help_text().contains("repository-file")); assert!(
output
.stdout
.contains("require the Workspace-scoped Backend")
);
assert!(!output.stdout.contains("repository-file"));
} }
} }
+8 -4
View File
@@ -178,9 +178,12 @@ pub fn parse_ticket_args(args: &[String]) -> Result<TicketCli, TicketCliError> {
} }
pub fn run(cli: TicketCli, target: ResolvedTarget) -> Result<TicketCliOutput, TicketCliError> { pub fn run(cli: TicketCli, target: ResolvedTarget) -> Result<TicketCliOutput, TicketCliError> {
if cli == TicketCli::Help {
return Ok(success(help_text().to_string()));
}
match target { match target {
ResolvedTarget::Standalone => Err(TicketCliError::new( ResolvedTarget::Standalone => Err(TicketCliError::new(
"Standalone is a one-shot Worker host, not Ticket storage authority; select a Backend target; select a Backend target", "Standalone is a one-shot Worker host, not Ticket storage authority; select a Backend target",
)), )),
ResolvedTarget::Backend { ResolvedTarget::Backend {
base_url, base_url,
@@ -966,8 +969,9 @@ mod tests {
} }
#[test] #[test]
fn help_states_backend_authority() { fn help_is_available_without_ticket_storage_authority() {
assert!(help_text().contains("Workspace-scoped Backend")); let output = run(TicketCli::Help, ResolvedTarget::Standalone).unwrap();
assert!(!help_text().contains("repository-file Ticket backend")); assert!(output.stdout.contains("Workspace-scoped Backend"));
assert!(!output.stdout.contains("repository-file Ticket backend"));
} }
} }