add PowerShell for Mac and Linux

This commit is contained in:
AJ ONeal
2020-06-30 06:16:01 +00:00
parent 7109e9faff
commit 693613da4b
4 changed files with 82 additions and 1 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
// this may need customizations between packages
var osMap = {
macos: /(\b|_)(apple|mac|darwin|iPhone|iOS|iPad)/i,
macos: /(\b|_)(apple|os\s?x\b|mac|darwin|iPhone|iOS|iPad)/i,
linux: /(\b|_)(linux)/i,
freebsd: /(\b|_)(freebsd)/i,
windows: /(\b|_)(win|microsoft|msft)/i,
+17
View File
@@ -0,0 +1,17 @@
---
title: Microsoft PowerShell
homepage: https://docs.microsoft.com/en-us/powershell/
tagline: |
PowerShell Core is a cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework.
description: |
PowerShell is the default shell on Windows 10. Since `curl.exe | powershell` is effectively as convenient as `curl | bash` for users, and since Windows 10 also includes tar, curl.exe, and ssh, among others, you can use fairly simple PowerShell to make a variety of tasks simple for Windows developers.
---
For example, if you wanted to install Node.js with powershell and
webinstall.dev, you can:
```cmd
curl.exe -s -A "MS" https://webinstall.dev/node@lts | powershell
```
<!-- TODO if, pipe, function -->
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
{
set -e
set -u
pkg_cmd_name="pwsh"
# no ./bin prefix
pkg_src_cmd="$HOME/.local/opt/pwsh-v$WEBI_VERSION/pwsh"
pkg_dst_cmd="$HOME/.local/opt/pwsh/pwsh"
pkg_get_current_version() {
# 'pwsh --version' has output in this format:
# PowerShell 7.0.2
# This trims it down to just the version number:
# 7.0.2
echo "$(pwsh --version 2>/dev/null | head -n 1 | cut -d' ' -f2)"
}
pkg_install() {
# mv ./* "$HOME/.local/opt/pwsh-v7.0.2"
mkdir -p "$pkg_src"
mv ./* "$pkg_src"
# symlink powershell to pwsh
pushd "$pkg_src" >/dev/null
ln -s pwsh powershell
popd >/dev/null
}
pkg_link() {
# rm -f "$HOME/.local/opt/pwsh"
rm -f "$pkg_dst"
# ln -s "$HOME/.local/opt/pwsh-v7.0.2" "$HOME/.local/opt/pwsh"
ln -s "$pkg_src" "$pkg_dst"
}
pkg_done_message() {
echo "Installed 'pwsh' at $pkg_dst"
}
}
+22
View File
@@ -0,0 +1,22 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'powershell';
var repo = 'powershell';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
// remove checksums and .deb
all.releases = all.releases.filter(function (rel) {
return !/(alpine)|(fxdependent)|(\.deb)|(\.pkg)|(\.rpm)$/i.test(rel.name);
});
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all));
});
}