Instantiate psobject directly
This commit is contained in:
parent
54e5289f79
commit
fb43772429
9 changed files with 12 additions and 12 deletions
|
@ -8,6 +8,6 @@ If ($args.Length -gt 0)
|
|||
|
||||
$data = 'FIXME';
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -8,6 +8,6 @@ If ($args.Length -gt 0)
|
|||
|
||||
$data = 'FIXME';
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -8,6 +8,6 @@ If ($args.Length -gt 0)
|
|||
|
||||
$data = 'FIXME';
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -8,6 +8,6 @@ If ($args.Length -gt 0)
|
|||
|
||||
$data = 'FIXME';
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -8,6 +8,6 @@ If ($args.Length -gt 0)
|
|||
|
||||
$data = 'FIXME';
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name fixme -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -12,6 +12,6 @@ If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data'
|
|||
$data = $params.data;
|
||||
}
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name ping -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!powershell
|
||||
# WANT_JSON
|
||||
|
||||
$params = '{}' | ConvertFrom-Json;
|
||||
$params = New-Object psobject;
|
||||
If ($args.Length -gt 0)
|
||||
{
|
||||
$params = Get-Content $args[0] | ConvertFrom-Json;
|
||||
|
@ -27,7 +27,7 @@ If (-not $src)
|
|||
$bytes = [System.IO.File]::ReadAllBytes($src);
|
||||
$content = [System.Convert]::ToBase64String($bytes);
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name content -Value $content;
|
||||
$result | Add-Member -MemberType NoteProperty -Name encoding -Value 'base64';
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!powershell
|
||||
# WANT_JSON
|
||||
|
||||
$params = '{}' | ConvertFrom-Json;
|
||||
$params = New-Object psobject;
|
||||
If ($args.Length -gt 0)
|
||||
{
|
||||
$params = Get-Content $args[0] | ConvertFrom-Json;
|
||||
|
@ -19,7 +19,7 @@ If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'get_m
|
|||
$get_md5 = $params.get_md5;
|
||||
}
|
||||
|
||||
$stat = '{}' | ConvertFrom-Json;
|
||||
$stat = New-Object psobject;
|
||||
If (Test-Path $path)
|
||||
{
|
||||
$stat | Add-Member -MemberType NoteProperty -Name exists -Value $TRUE;
|
||||
|
@ -45,7 +45,7 @@ If ($get_md5 -and $stat.exists -and -not $stat.isdir)
|
|||
$stat | Add-Member -MemberType NoteProperty -Name md5 -Value $path_md5;
|
||||
}
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name stat -Value $stat;
|
||||
$result | Add-Member -MemberType NoteProperty -Name changed -Value $FALSE;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
|
|
@ -12,7 +12,7 @@ If (($params | Get-Member | Select-Object -ExpandProperty Name) -contains 'data'
|
|||
$data = $params.data;
|
||||
}
|
||||
|
||||
$result = '{}' | ConvertFrom-Json;
|
||||
$result = New-Object psobject;
|
||||
$result | Add-Member -MemberType NoteProperty -Name ping -Value $data;
|
||||
echo $result | ConvertTo-Json;
|
||||
|
||||
|
|
Loading…
Reference in a new issue