Skip to content

Commit

Permalink
Added nvm for windows dictionary
Browse files Browse the repository at this point in the history
Resolves: #17
  • Loading branch information
AnderssonPeter committed Jan 4, 2023
1 parent a655e4f commit f531533
Showing 1 changed file with 185 additions and 0 deletions.
185 changes: 185 additions & 0 deletions PowerType/Dictionaries/nvm4win.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
$installedVersions = [DynamicSource]@{
Name = "versions";
Description = "A all installed node versions";
CommandExpression = {
nvm list | % { [regex]::match($_, '(\d+\.\d+\.\d+)').Groups[1].Value } | ? {$_.trim() -ne "" }
};
Cache = [Cache]@{
ByTime = New-TimeSpan -Seconds 10
}
}

$versionsToInstall = [StaticSource]@{
Name = "Versions to install";
Description = "";
Items = @(
[SourceItem]@{
Name = "latest";
Description = ""
},
[SourceItem]@{
Name = "lts";
Description = ""
}
)
}

$architecture = [StaticSource]@{
Name = "Proxies";
Description = "";
Items = @(
[SourceItem]@{
Name = "64";
Description = "64 bit"
}
[SourceItem]@{
Name = "32";
Description = "32 bit"
}
)
}

$proxies = [StaticSource]@{
Name = "Proxies";
Description = "";
Items = @(
[SourceItem]@{
Name = "none";
Description = ""
}
)
}

[PowerTypeDictionary]@{
Platforms = ([Platforms]::Windows);
State = [DictionaryState]::Experimental -bor [DictionaryState]::Complete;
Source = "Hand crafted";
Url = "https://github.com/coreybutler/nvm-windows";
Keys = @("nvm");
Name = "nvm for windows";
Description = "A node.js version management utility for Windows. Ironically written in Go.";
Parameters = @(
[CommandParameter]@{
Keys = @("arch");
Name = "arch";
Description = "Show if node is running in 32 or 64 bit mode";
}
[CommandParameter]@{
Keys = @("current");
Name = "current";
Description = "Display active version";
}
[CommandParameter]@{
Keys = @("install");
Name = "install";
Description = "install specified node version";
Parameters = @(
[ValueParameter]@{
Name = "version";
Description = "version to install";
Source = $versionsToInstall;
}
[ValueParameter]@{
Name = "architecture";
Description = "architecture to install";
Source = $architecture;
}
);
}
[CommandParameter]@{
Keys = @("list", "ls");
Name = "list";
Description = "List the node.js installations";
Parameters = @(
[FlagParameter]@{
Keys = @("available");
Name = "available";
Description = "see what can be installed";
}
);
}
[CommandParameter]@{
Keys = @("on");
Name = "on";
Description = "Enable node.js version management";
}
[CommandParameter]@{
Keys = @("off");
Name = "off";
Description = "Disable node.js version management";
}
[CommandParameter]@{
Keys = @("proxy");
Name = "proxy";
Description = "Set a proxy to use for downloads. Leave [url] blank to see the current proxy";
Parameters = @(
[ValueParameter]@{
Name = "url";
Description = "Set [url] to 'none' to remove the proxy";
Source = $proxies
}
);
}
[CommandParameter]@{
Keys = @("node_mirror");
Name = "node_mirror";
Description = "Set the node mirror";
Parameters = @(
[ValueParameter]@{
Name = "url";
Description = "Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url";
}
);
}
[CommandParameter]@{
Keys = @("npm_mirror");
Name = "npm_mirror";
Description = "Set the npm mirror";
Parameters = @(
[ValueParameter]@{
Name = "url";
Description = "Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url";
}
);
}
[CommandParameter]@{
Keys = @("uninstall");
Name = "uninstall";
Description = "uninstall specified node version";
Parameters = @(
[ValueParameter]@{
Name = "version";
Description = "version to install";
Source = $installedVersions;
}
);
}
[CommandParameter]@{
Keys = @("use");
Name = "use";
Description = "Switch to use the specified version";
Parameters = @(
[ValueParameter]@{
Name = "version";
Description = "";
Source = $installedVersions
}
[ValueParameter]@{
Name = "architecture";
Description = "architecture to install";
Source = $architecture;
}
);
}
[CommandParameter]@{
Keys = @("root");
Name = "root";
Description = "Set the directory where nvm should store different versions of node.js";
}
[CommandParameter]@{
Keys = @("version", "v");
Name = "version";
Description = "Displays the current running version of nvm for Windows. Aliased as v";
}
)
}

0 comments on commit f531533

Please sign in to comment.