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.
43 lines
1.1 KiB
43 lines
1.1 KiB
open Fnm; |
|
|
|
exception Cant_read_local_versions; |
|
|
|
let main = () => |
|
Versions.Local.( |
|
{ |
|
let%lwt versions = |
|
try%lwt(Versions.getInstalledVersions()) { |
|
| _ => Lwt.fail(Cant_read_local_versions) |
|
} |
|
and currentVersion = Versions.getCurrentVersion(); |
|
|
|
Console.log("The following versions are installed:"); |
|
|
|
versions |
|
|> List.iter(version => { |
|
let color = |
|
switch (currentVersion) { |
|
| None => None |
|
| Some(x) when x.name == version.name => Some(Pastel.Cyan) |
|
| Some(_) => None |
|
}; |
|
let aliases = |
|
List.length(version.aliases) === 0 |
|
? "" |
|
: Printf.sprintf( |
|
" (%s)", |
|
version.aliases |> String.concat(", "), |
|
); |
|
Console.log(<Pastel ?color> "* " {version.name} aliases </Pastel>); |
|
}); |
|
|
|
Lwt.return_ok(); |
|
} |
|
); |
|
|
|
let run = () => |
|
try%lwt(main()) { |
|
| Cant_read_local_versions => |
|
Console.log("No versions installed!"); |
|
Lwt.return_ok(); |
|
};
|
|
|