MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / require_view

Function require_view

atomic-cli/src/commands/triage/mod.rs:324–330  ·  view source on GitHub ↗

Fail with an actionable message when a triage view argument names a view that does not exist. The usual cause is typing the placeholder from the help text (`atomic triage review feature`) instead of a real view name, so the message says the argument is optional and names the current view as the value to simply drop in — or the value to leave off entirely.

(repo: &Repository, name: &str, arg: &str)

Source from the content-addressed store, hash-verified

322/// says the argument is optional and names the current view as the value to
323/// simply drop in — or the value to leave off entirely.
324fn require_view(repo: &Repository, name: &str, arg: &str) -> CliResult<()> {
325 if repo.view_exists(name).map_err(CliError::Repository)? {
326 Ok(())
327 } else {
328 Err(unknown_view(repo, name, arg))
329 }
330}
331
332/// The error for a view name that does not resolve.
333fn unknown_view(repo: &Repository, name: &str, arg: &str) -> CliError {

Callers 1

resolve_viewsFunction · 0.85

Calls 2

unknown_viewFunction · 0.85
view_existsMethod · 0.80

Tested by

no test coverage detected