From b11a3c96c90a68793aeb8543bb2af4df5ff95838 Mon Sep 17 00:00:00 2001 From: David Schoch Date: Thu, 13 Feb 2025 18:49:54 +0100 Subject: [PATCH] fixed cli calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maƫlle Salmon --- R/flow.R | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/R/flow.R b/R/flow.R index 09c344f2c6..8a852f0f58 100644 --- a/R/flow.R +++ b/R/flow.R @@ -291,7 +291,10 @@ min_cut <- function(graph, source = NULL, target = NULL, capacity = NULL, value. } if (xor(is.null(source), is.null(target))) { - cli::cli_abort("Please give both source and target or neither") + cli::cli_abort(c( + "{.arg source} and {.arg target} must not be specified at the same time.", + i = "Specify either {.arg source} or {.arg target} or neither." + )) } if (!is.null(capacity)) { @@ -433,7 +436,10 @@ vertex_connectivity <- function(graph, source = NULL, target = NULL, checks = TR as_igraph_vs(graph, target) - 1 ) } else { - cli::cli_abort("Either give both source and target or neither") + cli::cli_abort(c( + "{.arg source} and {.arg target} must not be specified at the same time.", + i = "Specify either {.arg source} or {.arg target} or neither." + )) } } @@ -530,7 +536,10 @@ edge_connectivity <- function(graph, source = NULL, target = NULL, checks = TRUE as_igraph_vs(graph, source) - 1, as_igraph_vs(graph, target) - 1 ) } else { - cli::cli_abort("Either give both source and target or neither") + cli::cli_abort(c( + "{.arg source} and {.arg target} must not be specified at the same time.", + i = "Specify either {.arg source} or {.arg target} or neither." + )) } } @@ -731,7 +740,7 @@ dominator_tree <- function(graph, root, mode = c("out", "in", "all", "total")) { ensure_igraph(graph) root <- as_igraph_vs(graph, root) if (length(root) == 0) { - cli::cli_abort("No vertex was specified") + cli::cli_abort("{.arg root} must be specified.") } mode <- switch(igraph.match.arg(mode), "out" = 1,