( maybe_config: Result<Config, AppError>, tag_name: String, after_workon: Option<String>, after_clone: Option<String>, priority: Option<u8>, tag_workspace: Option<String>, )
| 65 | } |
| 66 | |
| 67 | pub fn create_tag( |
| 68 | maybe_config: Result<Config, AppError>, |
| 69 | tag_name: String, |
| 70 | after_workon: Option<String>, |
| 71 | after_clone: Option<String>, |
| 72 | priority: Option<u8>, |
| 73 | tag_workspace: Option<String>, |
| 74 | ) -> Result<(), AppError> { |
| 75 | let config: Config = maybe_config?; |
| 76 | let tags: BTreeMap<String, Tag> = config.settings.tags.unwrap_or_default(); |
| 77 | |
| 78 | if tags.contains_key(&tag_name) { |
| 79 | Err(AppError::UserError(format!("Tag {} already exists, not gonna overwrite it for you", tag_name))) |
| 80 | } else { |
| 81 | let new_tag = Tag { |
| 82 | after_clone, |
| 83 | after_workon, |
| 84 | priority, |
| 85 | workspace: tag_workspace, |
| 86 | default: None, |
| 87 | tag_config_path: "default".to_string(), |
| 88 | }; |
| 89 | config::write_tag(&tag_name, &new_tag)?; |
| 90 | Ok(()) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | pub fn inspect_tag(maybe_config: Result<Config, AppError>, tag_name: &str) -> Result<(), AppError> { |
| 95 | let config: Config = maybe_config?; |
no test coverage detected