-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrap.ps1
91 lines (76 loc) · 2.34 KB
/
scrap.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# function t.Simplify.PropertyTypes.iter1 {
# <#
# .SYNOPSIS
# maybe name it Format because it renders short names?
# #>
# [Alias('t.Simplify.Props')]
# $InputObject = $Input
# $query = $InputObject | Find-Member
# $query
# | select Name, DeclaringType, ReflectedType, PropertyType
# | %{ $row = $_
# $row | Add-Member -ea 0 -force -PassThru -NotePropertyMembers @{
# Declare = $_.DeclaringType | Format-ShortTypeName
# Reflect = $_.ReflectedType | Format-ShortTypeName
# Property = $_.PropertyType | Format-ShortTypeName
# DisplayString = $_.DisplayString
# }
# }
# }
throw 'finish my sketch'
'Others still wip
.Summarize.SharedProperties
.Summarize.CollectionSharedProperties
.Excel.Write.Sheet.Name
.Join-Str.Alias
.Iter.Text
.Iter.Enumerator
.Summarize.CollectionSharedProperties
.Iter.Prop
'
| write-host -back 'darkred'
$obj = Set-Alias 'abc' -Value 'CountOf' -PassThru
function t.Simplify.PropertyTypes {
<#
.SYNOPSIS
maybe name it Format because it renders short names?
#>
[Alias('t.Simplify.Props')]
$InputObject = $Input
$query = @(
$InputObject | Find-Member )
# [Collections.Generic.List[Object]]$propsToModify = @(
[string[]]$propsToModify = @(
'DeclaringType'
'ReflectedType'
'PropertyType'
# 'DisplayString'
# Name, DeclaringType, ReflectedType, PropertyType
)
$selectSplat = @{
ErrorAction = 'ignore'
Property = '*'
# Property = $propsToModify, '*'
}
$query
| select @selectSplat
| %{
$row = $_
$newValues = [ordered]@{}
foreach($propName in $propsToModify) {
$newValues[ $propName ] =
$row.$PropName | Format-ShortTypeName
}
$newValues | json
$newValues | ft
$row
| Add-Member -ea 0 -force -PassThru -NotePropertyMembers $NewValues
# $row | Add-Member -ea 0 -force -PassThru -NotePropertyMembers @{
# Declare = $_.DeclaringType | Format-ShortTypeName
# Reflect = $_.ReflectedType | Format-ShortTypeName
# Property = $_.PropertyType | Format-ShortTypeName
# DisplayString = $_.DisplayString
# }
}
}
$obj | t.Simplify.PropertyTypes