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

Method validate_view_name

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

Validate the view name.

(&self)

Source from the content-addressed store, hash-verified

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

Calls 2

is_emptyMethod · 0.45
containsMethod · 0.45