Fork of daniellemaywood.uk/gleam — Wasm codegen work
723 B
37 lines
1$ErrorActionPreference = "Stop"
2
3$PackageName = "$PACKAGE_NAME_FROM_GLEAM"
4$BaseDirectory = $PSScriptRoot
5$ScriptCommand = $args[0]
6
7$CodePath = Join-Path -Path $BaseDirectory -ChildPath "\*\ebin" -Resolve
8
9function Run {
10 erl `
11 -pa $CodePath `
12 -eval "$PackageName@@main:run($PackageName)" `
13 -noshell `
14 -extra $args
15}
16
17function Shell {
18 erl -pa $CodePath
19}
20
21switch ($ScriptCommand) {
22 "run" {
23 Run $args[1..($args.Length - 1)]
24 }
25 "shell" {
26 Shell
27 }
28 default {
29 Write-Host "usage:"
30 Write-Host " entrypoint.ps1 `$COMMAND"
31 Write-Host ""
32 Write-Host "commands:"
33 Write-Host " run Run the project main function"
34 Write-Host " shell Run an Erlang shell"
35 exit 1
36 }
37}