Gal Schlezinger
6 years ago
committed by
GitHub
4 changed files with 41 additions and 40 deletions
@ -1,41 +1,42 @@
@@ -1,41 +1,42 @@
|
||||
open Fnm; |
||||
open Lwt; |
||||
open Lwt.Infix; |
||||
|
||||
let run = (~version) => { |
||||
Versions.getInstalledVersions() |
||||
>|= List.find_opt(x => Versions.Local.(x.name == version)) |
||||
>>= ( |
||||
installedVersion => |
||||
switch (installedVersion) { |
||||
| None => |
||||
Logger.error( |
||||
<Pastel> |
||||
"The version " |
||||
<Pastel color=Pastel.Cyan> version </Pastel> |
||||
" is not installed." |
||||
</Pastel>, |
||||
); |
||||
exit(1); |
||||
| Some(installedVersion) => |
||||
Logger.debug( |
||||
<Pastel> |
||||
"Uninstalling node " |
||||
<Pastel color=Pastel.Cyan> |
||||
Versions.Local.(installedVersion.name) |
||||
</Pastel> |
||||
</Pastel>, |
||||
); |
||||
let%lwt _ = Versions.Local.remove(installedVersion); |
||||
Logger.info( |
||||
<Pastel> |
||||
"Node version " |
||||
<Pastel color=Pastel.Cyan> |
||||
Versions.Local.(installedVersion.name) |
||||
</Pastel> |
||||
" has correctly been removed." |
||||
</Pastel>, |
||||
) |
||||
|> Lwt.return; |
||||
} |
||||
); |
||||
let version = Versions.format(version); |
||||
|
||||
let%lwt installedVersion = |
||||
Versions.getInstalledVersions() |
||||
>|= List.find_opt(x => Versions.Local.(x.name == version)); |
||||
|
||||
switch (installedVersion) { |
||||
| None => |
||||
Logger.error( |
||||
<Pastel> |
||||
"The version " |
||||
<Pastel color=Pastel.Cyan> version </Pastel> |
||||
" is not installed." |
||||
</Pastel>, |
||||
); |
||||
exit(1); |
||||
| Some(installedVersion) => |
||||
Logger.debug( |
||||
<Pastel> |
||||
"Uninstalling node " |
||||
<Pastel color=Pastel.Cyan> |
||||
Versions.Local.(installedVersion.name) |
||||
</Pastel> |
||||
</Pastel>, |
||||
); |
||||
let%lwt _ = Versions.Local.remove(installedVersion); |
||||
Logger.info( |
||||
<Pastel> |
||||
"Node version " |
||||
<Pastel color=Pastel.Cyan> |
||||
Versions.Local.(installedVersion.name) |
||||
</Pastel> |
||||
" has correctly been removed." |
||||
</Pastel>, |
||||
); |
||||
Lwt.return_unit; |
||||
}; |
||||
}; |
||||
|
Loading…
Reference in new issue