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

Method validate_view_name

atomic-cli/src/commands/init.rs:464–492  ·  view source on GitHub ↗

Validate the view name.

(&self)

Source from the content-addressed store, hash-verified

462
463 /// Validate the view name.
464 fn validate_view_name(&self) -> CliResult<()> {
465 let name = &self.view;
466
467 if name.is_empty() {
468 return Err(CliError::InvalidArgument {
469 message: "View name cannot be empty".to_string(),
470 });
471 }
472
473 if name.contains('/') || name.contains('\\') {
474 return Err(CliError::InvalidArgument {
475 message: "View name cannot contain path separators".to_string(),
476 });
477 }
478
479 if name.starts_with('.') {
480 return Err(CliError::InvalidArgument {
481 message: "View name cannot start with a dot".to_string(),
482 });
483 }
484
485 if name.contains(char::is_whitespace) {
486 return Err(CliError::InvalidArgument {
487 message: "View name cannot contain whitespace".to_string(),
488 });
489 }
490
491 Ok(())
492 }
493}
494
495impl Default for Init {

Calls 2

is_emptyMethod · 0.45
containsMethod · 0.45