| 155 | } |
| 156 | |
| 157 | fn handle_boolean_flag(parsed: &mut ParsedArgs, flag: &str) -> Result<(), ParseError> { |
| 158 | match flag { |
| 159 | "help" | "h" => parsed.help = true, |
| 160 | "version" | "v" => parsed.version = true, |
| 161 | "keep-style-tags" => parsed.keep_style_tags = true, |
| 162 | "keep-link-tags" => parsed.keep_link_tags = true, |
| 163 | "keep-at-rules" => parsed.keep_at_rules = true, |
| 164 | "minify-css" => parsed.minify_css = true, |
| 165 | "remove-inlined-selectors" => parsed.remove_inlined_selectors = true, |
| 166 | "apply-width-attributes" => parsed.apply_width_attributes = true, |
| 167 | "apply-height-attributes" => parsed.apply_height_attributes = true, |
| 168 | _ => { |
| 169 | return Err(ParseError { |
| 170 | message: format!("Unknown flag: {flag}"), |
| 171 | }) |
| 172 | } |
| 173 | } |
| 174 | Ok(()) |
| 175 | } |
| 176 | |
| 177 | fn combine_extra_css( |
| 178 | extra_css: Option<String>, |