Adds from_str
This commit is contained in:
		
							parent
							
								
									ce15d374fb
								
							
						
					
					
						commit
						07dc60cc79
					
				@ -16,8 +16,11 @@ pub enum Os {
 | 
			
		||||
impl Os {
 | 
			
		||||
    pub fn detect() -> Option<Os> {
 | 
			
		||||
        let lsb_release = lsb_release().unwrap();
 | 
			
		||||
        Os::from_str(lsb_release.trim())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        match lsb_release.trim() {
 | 
			
		||||
    pub fn from_str(os: &str) -> Option<Os> {
 | 
			
		||||
        match os {
 | 
			
		||||
            "archlinux" | "Arch Linux" | "arch" | "Arch" | "archarm" =>  Some(Os::ArchLinux),
 | 
			
		||||
            "Debian" => Some(Os::Debian),
 | 
			
		||||
            "ManjaroLinux" => Some(Os::Manjaro),
 | 
			
		||||
@ -27,7 +30,6 @@ impl Os {
 | 
			
		||||
 | 
			
		||||
            _ => None,
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn ascii_logo(self) -> &'static str {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user