forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fxd.ps1
37 lines (28 loc) · 806 Bytes
/
fxd.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
param(
$Command
)
$ErrorActionPreference = 'Stop'
if (!$Command) {
$Command = 'help'
}
$CommandScript = "$PSScriptRoot\code\tools\fxd\$Command.ps1"
if (!(Test-Path $CommandScript)) {
"fxd: invalid command '$Command' - run 'fxd help' for help"
return
}
if ($args.Contains('-?') -or $args.Contains('-help') -or $args.Contains('--help') -or $args.Contains('/?')) {
$helpArgs = ,($args | Select-Object -Skip 1)
if ($null -eq $helpArgs[0]) {
$helpArgs = @()
}
& "Get-Help" $CommandScript @helpArgs |
Out-String |
ForEach-Object {
$_ `
-replace "[^\s]*\\(.*?)\.ps1", "fxd `$1" `
-replace "Get-Help fxd ([^ ]+)", "fxd `$1 -?"
}
return
}
$moreArgs = $args
Invoke-Expression "$CommandScript @moreArgs"