forked from rouge-ruby/rouge
/
sqf
52 lines (43 loc) · 1.48 KB
/
sqf
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
/*
* Author: BaerMitUmlaut
* Generates and dumps a list of all currently available commands.
* List can be dumped to clipboard or global variable.
*
* Arguments:
* 0: Dump target (clipboard|var:VARNAME) <STRING>
* 1: List delimiter (default: new line) <STRING>
*
* Return Value:
* None
*/
#define SORT_ASC true
#define SORT_DESC false
#define MAKE_UNIQUE(arr) (arr arrayIntersect arr)
params [
["_target", "clipboard", [""]],
["_delimiter", endl, [""]]
];
private _supportInfo = supportInfo "";
// Remove types from list
private _allCommands = _supportInfo select {_x find "t:" == -1};
// Sort commands into categories for processing
private _nulars = _allCommands select {_x find "n:" == 0};
private _unaries = _allCommands select {_x find "u:" == 0};
private _binaries = _allCommands select {_x find "b:" == 0};
// Remove argument types from command description
_nulars = _nulars apply {_x select [2]};
_unaries = _unaries apply {_x select [2]};
_unaries = _unaries apply {_x splitString " " select 0};
_binaries = _binaries apply {_x splitString " " select 1};
// Merge lists
private _commandList = _nulars + _unaries + _binaries;
_commandList = MAKE_UNIQUE(_commandList);
_commandList sort SORT_ASC;
// Dump list
if (_target find "var:" == 0) then {
missionNamespace setVariable [_target select [4], _commandList];
} else {
_commandList = _commandList joinString _delimiter;
copyToClipboard _commandList;
};
// comment at eof