Skip to content

Commit 083ebff

Browse files
committed
egrep --color -i 'what you look for'
1 parent ff1a18b commit 083ebff

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

manage-extensions/monitor.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,28 @@ function getRequireExtensions($lines) {
9090
// echo implode(", ", $extensions);
9191

9292
// PRINT
93+
printf("Highlight by adding | egrep --color -i 'what you look for'\n");
9394
printf("\n");
9495
$headers = array("w/extensions/" => $folders, "wfLoadExtensions()" => $wfLEs, "require" => $rEs, "composer.json" => $composerjsonReq, "composer.local.json" => $composerlocaljsonReq, "mwmLocalSettings.php" => $wfLEs2, "mwmconfigdb.sqlite" => $mwmLocalSettingsString, "API" => $extensions);
96+
$numberOfAddedTabs = 3;
9597
foreach($headers as $header => $variable) {
96-
printf($header."\t\t");
98+
printf($header.str_repeat("\t", $numberOfAddedTabs));
9799
}
98100
printf("\n");
99101
foreach($headers as $header => $variable) {
100-
printf(str_repeat("-", strlen($header))."\t\t");
102+
printf(str_repeat("-", strlen($header)).str_repeat("\t", $numberOfAddedTabs));
101103
}
102104
printf("\n");
103-
$maxLength = 22;
104105
$tabWidth = 8;
105-
for ($x = 0; $x <= 60; $x++) {
106+
$manuallyAdded = 5;
107+
$continue = true;
108+
$x = 0;
109+
$maxLength = $numberOfAddedTabs * $tabWidth + $manuallyAdded;
110+
while ($continue) {
111+
$contCount = 0;
106112
foreach($headers as $header => $variable) {
107113
$headerRest = $tabWidth - strlen($header) % $tabWidth;
108-
$columnWidth = strlen($header) + $headerRest + (2 * $tabWidth);
114+
$columnWidth = strlen($header) + $headerRest + ($numberOfAddedTabs * $tabWidth);
109115
if(array_key_exists($x, $variable)) {
110116
$ss = substr($variable[$x], 0, $maxLength);
111117
$tsToAdd = floor(($columnWidth - strlen($ss)) / $tabWidth);
@@ -118,7 +124,15 @@ function getRequireExtensions($lines) {
118124
} else {
119125
printf(str_repeat("\t", $columnWidth / $tabWidth - 1));
120126
}
127+
// If the current aspect doesn't have a next element, then record this fact.
128+
if(!array_key_exists($x, $variable)) {
129+
$contCount++;
130+
}
131+
}
132+
// If in one loop none of the aspects have a next element, then stop.
133+
if($contCount == count($headers)){
134+
$continue = false;
121135
}
136+
$x++;
122137
printf("\n");
123138
}
124-
printf("\n");

0 commit comments

Comments
 (0)