์์ฝ
๋ณ์์ ์์ฑ(์ฆ, ์์ฑ ์์ฒด๊ฐ ํด์ ํ ์ด๋ธ์ธ ๊ฒฝ์ฐ)์ ๋ช ๋ น์ ์ฌ์ฉํ์ฌ ํ์ํ ์ ์๋ค๋ฉด ๋์์ด ๋ ๊ฒ์ ๋๋ค.
์ฝ๋ ์:
function Test-Demo {
[CmdletBinding()]
Param (
[Parameter()]
[string]$One
,
[Parameter()]
[string]$Two
)
"1 = $One"
"2 = $Two"
}
$test = @{
testInt = @{
One = '1'
Two = '2'
}
testString = @{
One = 'One'
Two = 'Two'
}
}
#to splat a property, we first need to assign the property to a "top level" variable:
$t = $test.testString
Test-Demo <strong i="10">@t</strong>
#however it would be nice if we could instead do this:
Test-Demo @test.testString
#or if that's not possible for some reason, maybe something like this:
Test-Demo ([splat]$test.testString)
์ด๊ฒ์ ๊ตฌ์ฑ ํ์ผ์ ๋ค๋ฃฐ ๋ ํนํ ์ ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๊ตฌ์ฑ์๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ ๋ณด(์ธ์คํด์ค, ์นดํ๋ก๊ทธ, ์๊ฒฉ ์ฆ๋ช )์ ๊ธฐ๋ฅ์ ํน์ ํ ๋ค๋ฅธ ์์ฑ์ด ํฌํจ๋ ์น์ ์ด ์์ต๋๋ค. ์
$config = Get-MyScriptConfig -Path '.\Config.xml'
Invoke-Something @config.DatabaseConnectionInfo @config.Something
https://github.com/PowerShell/PowerShell-RFC/issues/6 ์ ๋ถํ์์ผ์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค. RFC ์ด์์ ๋ค์๊ณผ ๊ฐ์ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ์ฌ ์ผ๋ฐํ๋ ํํ์ ์ ์ํฉ๋๋ค.
Test-Demo @$test.testString
@JohnLBevan https://github.com/PowerShell/PowerShell-RFC/issues/6์ ๋ณด๊ณ ๋ฌธ์ ๋ฅผ ๋ซ์ ์ ์์ต๋๊น?
@iSazonov ; ์, ์ด๋ฏธ ์ฌ๊ธฐ์ ํฌํจ๋์ด ์๊ธฐ ๋๋ฌธ์ ๋ซํ์ ๊ธฐ์ฉ๋๋ค. ๊ณ ๋ง์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
https://github.com/PowerShell/PowerShell-RFC/issues/6 ์ ๋ถํ์์ผ์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค. RFC ์ด์์ ๋ค์๊ณผ ๊ฐ์ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ์ฌ ์ผ๋ฐํ๋ ํํ์ ์ ์ํฉ๋๋ค.