-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcmdline.au3
65 lines (58 loc) · 1.59 KB
/
cmdline.au3
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include-once
Func _CmdLine_Get($sKey, $mDefault = Null)
For $i = 1 To $CmdLine[0]
If $CmdLine[$i] = "/" & $sKey Or $CmdLine[$i] = "-" & $sKey Or $CmdLine[$i] = "--" & $sKey Then
If $CmdLine[0] >= $i + 1 Then
Return $CmdLine[$i + 1]
EndIf
EndIf
Next
Return $mDefault
EndFunc ;==>_CmdLine_Get
Func _CmdLine_KeyExists($sKey)
For $i = 1 To $CmdLine[0]
If $CmdLine[$i] = "/" & $sKey Or $CmdLine[$i] = "-" & $sKey Or $CmdLine[$i] = "--" & $sKey Then
Return True
EndIf
Next
Return False
EndFunc ;==>_CmdLine_KeyExists
Func _CmdLine_ValueExists($sValue)
For $i = 1 To $CmdLine[0]
If $CmdLine[$i] = $sValue Then
Return True
EndIf
Next
Return False
EndFunc ;==>_CmdLine_ValueExists
Func _CmdLine_FlagEnabled($sKey)
For $i = 1 To $CmdLine[0]
If StringRegExp($CmdLine[$i], "\+([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then
Return True
EndIf
Next
Return False
EndFunc ;==>_CmdLine_FlagEnabled
Func _CmdLine_FlagDisabled($sKey)
For $i = 1 To $CmdLine[0]
If StringRegExp($CmdLine[$i], "\-([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then
Return True
EndIf
Next
Return False
EndFunc ;==>_CmdLine_FlagDisabled
Func _CmdLine_FlagExists($sKey)
For $i = 1 To $CmdLine[0]
If StringRegExp($CmdLine[$i], "(\+|\-)([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then
Return True
EndIf
Next
Return False
EndFunc ;==>_CmdLine_FlagExists
Func _CmdLine_GetValByIndex($iIndex, $mDefault = Null)
If $CmdLine[0] >= $iIndex Then
Return $CmdLine[$iIndex]
Else
Return $mDefault
EndIf
EndFunc ;==>_CmdLine_GetValByIndex