File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use thiserror::Error;
55
66#[ derive( clap:: Parser , Debug ) ]
77pub struct Default {
8- link_version : version:: Local ,
8+ link_version : Option < version:: Local > ,
99}
1010
1111#[ derive( Error , Debug ) ]
@@ -18,10 +18,19 @@ impl Command for Default {
1818 type Error = Error ;
1919
2020 fn run ( & self , config : & Config ) -> Result < ( ) , Error > {
21- let cmd = super :: Alias {
22- alias : crate :: version:: Alias :: default ( ) ,
23- link_version : self . link_version ,
24- } ;
25- cmd. run ( config) . map_err ( Into :: into)
21+ let alias = crate :: version:: Alias :: default ( ) ;
22+ if let Some ( link_version) = self . link_version {
23+ let cmd = super :: Alias {
24+ alias,
25+ link_version,
26+ } ;
27+ cmd. run ( config) . map_err ( Into :: into)
28+ } else {
29+ match alias. resolve ( config. aliases_dir ( ) ) {
30+ Ok ( version) => println ! ( "{}" , version) ,
31+ Err ( _) => println ! ( "none" ) ,
32+ }
33+ Ok ( ( ) )
34+ }
2635 }
2736}
You can’t perform that action at this time.
0 commit comments