Powershell: ์žฌ์‚ฐ์„ ํŠ€๊ธฐ๋‹ค

์— ๋งŒ๋“  2017๋…„ 10์›” 25์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: PowerShell/PowerShell

์š”์•ฝ

๋ณ€์ˆ˜์˜ ์†์„ฑ(์ฆ‰, ์†์„ฑ ์ž์ฒด๊ฐ€ ํ•ด์‹œ ํ…Œ์ด๋ธ”์ธ ๊ฒฝ์šฐ)์„ ๋ช…๋ น์— ์‚ฌ์šฉํ•˜์—ฌ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ฝ”๋“œ ์˜ˆ:

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
Issue-Question Resolution-Answered

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

https://github.com/PowerShell/PowerShell-RFC/issues/6 ์„ ๋ถ€ํ™œ์‹œ์ผœ์•ผ ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. RFC ์ดˆ์•ˆ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ผ๋ฐ˜ํ™”๋œ ํ‘œํ˜„์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค.

Test-Demo @$test.testString

๋ชจ๋“  3 ๋Œ“๊ธ€

https://github.com/PowerShell/PowerShell-RFC/issues/6 ์„ ๋ถ€ํ™œ์‹œ์ผœ์•ผ ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. RFC ์ดˆ์•ˆ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ผ๋ฐ˜ํ™”๋œ ํ‘œํ˜„์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค.

Test-Demo @$test.testString

@JohnLBevan https://github.com/PowerShell/PowerShell-RFC/issues/6์„ ๋ณด๊ณ  ๋ฌธ์ œ๋ฅผ ๋‹ซ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

@iSazonov ; ์˜ˆ, ์ด๋ฏธ ์—ฌ๊ธฐ์— ํฌํ•จ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋‹ซํ˜€์„œ ๊ธฐ์ฉ๋‹ˆ๋‹ค. ๊ณ ๋ง™์Šต๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰