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.
44 lines
1.0 KiB
44 lines
1.0 KiB
![]()
6 years ago
|
open Fnm;
|
||
|
open Lwt;
|
||
|
|
||
|
let run = (~version) => {
|
||
|
Versions.getInstalledVersions()
|
||
|
>|= List.find_opt(x => Versions.Local.(x.name == version))
|
||
|
>>= (
|
||
|
installedVersion =>
|
||
|
switch (installedVersion) {
|
||
|
| None =>
|
||
|
Logger.log(
|
||
|
<Pastel>
|
||
|
"The version "
|
||
|
<Pastel color=Pastel.Cyan> version </Pastel>
|
||
|
" is not installed."
|
||
|
</Pastel>,
|
||
|
);
|
||
|
exit(1);
|
||
|
| Some(installedVersion) =>
|
||
|
{
|
||
|
Logger.log(
|
||
|
<Pastel>
|
||
|
"Uninstalling node "
|
||
|
<Pastel color=Pastel.Cyan>
|
||
|
Versions.Local.(installedVersion.name)
|
||
|
</Pastel>
|
||
|
</Pastel>,
|
||
|
);
|
||
|
};
|
||
|
let%lwt _ = Versions.Local.remove(installedVersion);
|
||
|
Logger.log(
|
||
|
<Pastel>
|
||
|
"Node version "
|
||
|
<Pastel color=Pastel.Cyan>
|
||
|
Versions.Local.(installedVersion.name)
|
||
|
</Pastel>
|
||
|
" has correctly been removed."
|
||
|
</Pastel>,
|
||
|
)
|
||
|
|> Lwt.return;
|
||
|
}
|
||
|
);
|
||
|
};
|