mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
migrate powershell to nix
This commit is contained in:
parent
f16eb5fa42
commit
f35d3f910f
7 changed files with 59 additions and 21 deletions
|
@ -23,4 +23,5 @@ args: {
|
|||
"rscript" = import ./rscript.nix args;
|
||||
"raku" = import ./raku.nix args;
|
||||
"racket" = import ./racket.nix args;
|
||||
"powershell" = import ./powershell.nix args;
|
||||
}
|
||||
|
|
58
runtimes/powershell.nix
Normal file
58
runtimes/powershell.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.powershell;
|
||||
in piston.mkRuntime {
|
||||
language = "powershell";
|
||||
version = pkg.version;
|
||||
|
||||
aliases = [
|
||||
"pwsh"
|
||||
"ps"
|
||||
"ps1"
|
||||
];
|
||||
|
||||
run = ''
|
||||
${pkg}/bin/pwsh "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
# test different file extension
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.code" = ''
|
||||
echo "OK"
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.code";
|
||||
})
|
||||
# test argv
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.pwsh" = ''
|
||||
foreach ($s in $args) {
|
||||
Write-Host $s
|
||||
}
|
||||
'';
|
||||
};
|
||||
args = ["OK"];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.pwsh";
|
||||
})
|
||||
# test stdin
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.pwsh" = ''
|
||||
$s = Read-Host
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "OK";
|
||||
packages = [];
|
||||
main = "test.pwsh";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue