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

Method validate_view_name

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

Validate the view name.

(&self)

Source from the content-addressed store, hash-verified

437
438 /// Validate the view name.
439 fn validate_view_name(&self) -> CliResult<()> {
440 let name = &self.view;
441
442 if name.is_empty() {
443 return Err(CliError::InvalidArgument {
444 message: "View name cannot be empty".to_string(),
445 });
446 }
447
448 if name.contains('/') || name.contains('\\') {
449 return Err(CliError::InvalidArgument {
450 message: "View name cannot contain path separators".to_string(),
451 });
452 }
453
454 if name.starts_with('.') {
455 return Err(CliError::InvalidArgument {
456 message: "View name cannot start with a dot".to_string(),
457 });
458 }
459
460 if name.contains(char::is_whitespace) {
461 return Err(CliError::InvalidArgument {
462 message: "View name cannot contain whitespace".to_string(),
463 });
464 }
465
466 Ok(())
467 }
468}
469
470impl Default for Init {

Calls 2

is_emptyMethod · 0.45
containsMethod · 0.45