@@ -22,17 +22,18 @@ pub async fn get_available_versions() -> Result<Vec<String>> {
2222 // 1. Try to load from valid cache
2323 if cache_path. exists ( )
2424 && let Ok ( metadata) = std:: fs:: metadata ( & cache_path)
25- && let Ok ( modified) = metadata. modified ( )
26- && let Ok ( elapsed) = modified. elapsed ( )
27- && elapsed < CACHE_DURATION
28- && let Ok ( mut file) = File :: open ( & cache_path) {
29- let mut contents = String :: new ( ) ;
30- if file. read_to_string ( & mut contents) . is_ok ( )
31- && let Ok ( versions) = serde_json:: from_str :: < Vec < String > > ( & contents)
32- {
33- return Ok ( versions) ;
34- }
35- }
25+ && let Ok ( modified) = metadata. modified ( )
26+ && let Ok ( elapsed) = modified. elapsed ( )
27+ && elapsed < CACHE_DURATION
28+ && let Ok ( mut file) = File :: open ( & cache_path)
29+ {
30+ let mut contents = String :: new ( ) ;
31+ if file. read_to_string ( & mut contents) . is_ok ( )
32+ && let Ok ( versions) = serde_json:: from_str :: < Vec < String > > ( & contents)
33+ {
34+ return Ok ( versions) ;
35+ }
36+ }
3637
3738 // 2. Fetch from remote with a spinner
3839 println ! (
@@ -66,13 +67,14 @@ pub async fn get_available_versions() -> Result<Vec<String>> {
6667 {
6768 versions. push ( version. to_string ( ) ) ;
6869 }
69- } else if href. starts_with ( "php-" ) && href. ends_with ( "-cli-linux-x86_64.tar.gz" )
70+ } else if href. starts_with ( "php-" )
71+ && href. ends_with ( "-cli-linux-x86_64.tar.gz" )
7072 && let Some ( version) = href
7173 . strip_prefix ( "php-" )
7274 . and_then ( |h| h. strip_suffix ( "-cli-linux-x86_64.tar.gz" ) )
73- {
74- versions. push ( version. to_string ( ) ) ;
75- }
75+ {
76+ versions. push ( version. to_string ( ) ) ;
77+ }
7678 }
7779
7880 // Sort versions by splitting by dot and parsing as numbers
0 commit comments