-
Notifications
You must be signed in to change notification settings - Fork 1
/
mcp
59 lines (45 loc) · 1.05 KB
/
mcp
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
<?php
require_once(__DIR__ . '\bin\functions.php');
$matches = array_take($argv, 1, count($argv));
$params = [];
foreach($matches as $match) {
$m = [];
if(preg_match('/\-([\w\-]+)(?::([\w\-]+))?/', $match, $m) !== false) {
if(count($m) > 0) {
$params[$m[1]] = isset($m[2]) ? $m[2] : true;
}
}
}
$files = [
"fields.csv",
"methods.csv",
"params.csv",
];
foreach($files as $file) {
echo "[=========] $file [=========]\n";
$filefields = file_get_contents(__DIR__ . '\bin\MCP\\'.$file);
$fields = explode("\n", $filefields);
$show = 0;
foreach($fields as $field) {
$f = explode(",", $field);
if(isset($f[0], $f[1])) {
foreach($matches as $match) {
if(!($params['i']??false)) {
if(strpos($f[1], $match) !== false) {
echo str_pad($f[1], 30).": ".$f[0]."\n";
$show++;
}
} else {
if(strpos($f[0], $match) !== false) {
echo str_pad($f[0], 30).": ".$f[1]."\n";
}
}
}
}
}
if($show == 0) {
echo "No Results found.\n";
} else {
echo "\nLooked in ".count($fields)." results.\n";
}
}