1mod download;
12mod error;
13mod install;
14mod state;
15
16#[cfg(target_os = "macos")]
17mod macos;
18
19#[cfg(target_os = "linux")]
20mod linux;
21
22pub use download::{download_cask_artifact, ArtifactType};
23pub use error::{Error, Result};
24pub use install::{install_cask, uninstall_cask, CaskInstallOptions};
25pub use state::{InstalledCask, InstalledCasks};
26
27pub fn detect_artifact_type(url: &str) -> ArtifactType {
29 let url_lower = url.to_lowercase();
30
31 if url_lower.ends_with(".dmg") {
32 ArtifactType::Dmg
33 } else if url_lower.ends_with(".pkg") {
34 ArtifactType::Pkg
35 } else if url_lower.ends_with(".zip") {
36 ArtifactType::Zip
37 } else if url_lower.ends_with(".tar.gz") || url_lower.ends_with(".tgz") {
38 ArtifactType::TarGz
39 } else if url_lower.ends_with(".tar.bz2") || url_lower.ends_with(".tbz2") {
40 ArtifactType::TarBz2
41 } else if url_lower.ends_with(".appimage") {
42 ArtifactType::AppImage
43 } else {
44 ArtifactType::Zip
46 }
47}