I was looking at the posh-git code and I found the author doing this.

function script:gitCmdOperations($command, $filter) Needless to say I didn’t find anything on google about this, because google ignored the : and looking for script in a scripting language gives you lots of hits.

I then asked the question on twitter and after that I posted the question Stackoverflow.

And got this reply from user Rynant.

It defines the function’s scope to be the script scope. See: help about_scopes

Here is the complete text of help about_scopes

So I did that and found this.

Script:

The scope that is created while a script file runs. Only

the commands in the script run in the script scope. To

the commands in a script, the script scope is the local

scope.

Kaboom, head explodes.

But in short you can change the scope of a function by adding a scope modifier. Which is more usefull if you start nesting scopes. Like Shay Levy explains in his answer.

And user JasonMArcher adds to that.

It should be noted that script: scope doesn’t make any difference for functions that are right in the script. But it does make a different for nested functions.

And that’s when it started to make sense to me, kind of.

So if my understanding is correct than it doesn’t do much in the case of the posh-git code. But you can prove me wrong if you so desire.