powershell indentation

后端 未结 6 1624
小蘑菇
小蘑菇 2021-02-14 12:05

I\'m writing a large script that deploys an application. This script is based on several nested function calls.

Is there any way to \"ident\" the output based on the dep

6条回答
  •  孤独总比滥情好
    2021-02-14 12:58

    I used another line of thinking. I set a count variable that is incremented at the start of the function and then used the following code to pad the line I was writing:

    write-host ($string).PadLeft( ($string).length + (2 * $count) )
    

    This will indent two spaces for every recursion.

提交回复
热议问题