You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
909 B
37 lines
909 B
open Fnm; |
|
|
|
let run = (~name, ~version) => { |
|
let version = Versions.format(version); |
|
let%lwt matchingLocalVersions = |
|
LocalVersionResolver.getMatchingLocalVersions(version); |
|
|
|
switch (Base.List.hd(matchingLocalVersions)) { |
|
| Some(latestMatchingLocalVersion) => |
|
Logger.info( |
|
<Pastel> |
|
"Aliasing " |
|
<Pastel color=Pastel.Cyan> name </Pastel> |
|
" to " |
|
<Pastel color=Pastel.Cyan> {latestMatchingLocalVersion.name} </Pastel> |
|
</Pastel>, |
|
); |
|
|
|
let%lwt () = |
|
Versions.Aliases.set( |
|
~alias=name, |
|
~versionPath= |
|
Filename.concat( |
|
latestMatchingLocalVersion.fullPath, |
|
"installation", |
|
), |
|
); |
|
Lwt.return_ok(); |
|
| None => |
|
Logger.error( |
|
<Pastel color=Pastel.Red> |
|
"No installed versions found that match your criteria." |
|
</Pastel>, |
|
); |
|
Lwt.return_error(1); |
|
}; |
|
};
|
|
|