js-yaml.ps1 813 Bytes
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent

$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  # Fix case when both the Windows and Linux builds of Node
  # are installed in the same directory
  $exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
14
    $input | & "$basedir/node$exe"  "$basedir/../js-yaml/bin/js-yaml.js" $args
Rosanny Sihombing's avatar
Rosanny Sihombing committed
15
  } else {
16
    & "$basedir/node$exe"  "$basedir/../js-yaml/bin/js-yaml.js" $args
Rosanny Sihombing's avatar
Rosanny Sihombing committed
17
18
19
20
21
  }
  $ret=$LASTEXITCODE
} else {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
22
    $input | & "node$exe"  "$basedir/../js-yaml/bin/js-yaml.js" $args
Rosanny Sihombing's avatar
Rosanny Sihombing committed
23
  } else {
24
    & "node$exe"  "$basedir/../js-yaml/bin/js-yaml.js" $args
Rosanny Sihombing's avatar
Rosanny Sihombing committed
25
26
27
28
  }
  $ret=$LASTEXITCODE
}
exit $ret