Skip to content

Commit

Permalink
fixed cli calls
Browse files Browse the repository at this point in the history
Co-authored-by: Maëlle Salmon <[email protected]>
  • Loading branch information
schochastics and maelle authored Feb 13, 2025
1 parent ba73938 commit b11a3c9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions R/flow.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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."
))
}
}

Expand Down Expand Up @@ -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."
))
}
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b11a3c9

Please sign in to comment.