()
| 229 | |
| 230 | #[tokio::main] |
| 231 | async fn main() -> Result<()> { |
| 232 | let client = default_http_client()?; |
| 233 | let cli = Cli::parse(); |
| 234 | |
| 235 | // Fetch web features data for property descriptions |
| 236 | let web_features = get_web_features_data(&client).await?; |
| 237 | let property_descriptions = extract_property_descriptions(&web_features); |
| 238 | |
| 239 | match cli.command { |
| 240 | Commands::List => { |
| 241 | println!("Available CSS spec modules:"); |
| 242 | let specs = get_spec_versions(&client).await?; |
| 243 | let mut spec_names: Vec<_> = specs.keys().collect(); |
| 244 | spec_names.sort(); |
| 245 | for name in spec_names { |
| 246 | let versions = &specs[name]; |
| 247 | println!( |
| 248 | " {} (versions: {})", |
| 249 | name, |
| 250 | versions.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(", ") |
| 251 | ); |
| 252 | } |
| 253 | println!("Total: {} spec modules", specs.len()); |
| 254 | } |
| 255 | Commands::GenerateFeatureData => { |
| 256 | println!("Generating CSS feature data..."); |
| 257 | |
| 258 | println!(" Fetching web features data..."); |
| 259 | let features = get_web_features_data(&client).await?; |
| 260 | println!(" Fetched {} features", features.features.len()); |
| 261 | |
| 262 | println!(" Fetching CSS popularity data..."); |
| 263 | let popularity = get_css_popularity(&client).await?; |
| 264 | println!(" Fetched popularity data for {} properties", popularity.len()); |
| 265 | |
| 266 | println!(" Generating Rust code..."); |
| 267 | let code = generate_feature_data(&features, &popularity); |
| 268 | |
| 269 | println!(" Writing to file..."); |
| 270 | let workspace_root = find_workspace_root()?; |
| 271 | let output_path = workspace_root.join("crates").join("css_feature_data").join("src").join("data.rs"); |
| 272 | write(&output_path, code)?; |
| 273 | |
| 274 | println!("Generated feature data at {}", output_path.display()); |
| 275 | } |
| 276 | Commands::GenerateSpec { name, verbose } => { |
| 277 | println!("Generating spec: {}", name); |
| 278 | let specs = get_spec_versions(&client).await?; |
| 279 | match specs.get(&name) { |
| 280 | Some(versions) => { |
| 281 | println!("Found {} version(s) for spec '{}'", versions.len(), name); |
| 282 | generate_single_spec(&client, &name, versions, verbose, &property_descriptions, None).await?; |
| 283 | println!(" Spec generation complete"); |
| 284 | } |
| 285 | None => { |
| 286 | eprintln!(" Error: Spec '{}' not found", name); |
| 287 | eprintln!(" Run 'list' command to see available specs"); |
| 288 | std::process::exit(1); |
nothing calls this directly
no test coverage detected