Skip to content

Commit

Permalink
N°6420 dump_tasks : more info (#30)
Browse files Browse the repository at this point in the history
* Change header for clarity, and iTop URL is now in blue
* Change columns :
- remove description
- Id is 3 chars wide
- name has all the remaining width

---------

Co-authored-by: Thomas Casteleyn <[email protected]>
Co-authored-by: Molkobain <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2023
1 parent 3f01af9 commit 2d3a901
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions toolkit/dump_tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,31 @@
exit - 1;
}

echo "iTop: \033[34m{$sITopUrl}\033[0m\n";
if (empty($aResult['objects'])) {
echo "There is no SynchroDataSource defined on the iTop server ($sITopUrl).\n";
echo " no SynchroDataSource defined\n";
} else {
switch (count($aResult['objects'])){
switch (count($aResult['objects'])) {
case 1:
echo "There is 1 SynchroDataSource defined on the iTop server ($sITopUrl):\n";
echo " 1 SynchroDataSource defined\n";
break;

default:
echo "There are ".count($aResult['objects'])." SynchroDataSource defined on the iTop server ($sITopUrl):\n";
echo " ".count($aResult['objects'])." SynchroDataSource objects defined\n";
break;
}

echo "+--------------------------------+----------------------------------------------------+\n";
echo "| Name | Description |\n";
echo "+--------------------------------+----------------------------------------------------+\n";
echo "+-----+--------------------------------------------------------------------------------------+\n";
echo "| Id | Name |\n";
echo "+-----+--------------------------------------------------------------------------------------+\n";
foreach ($aResult['objects'] as $aValues) {
$aCurrentTaskDefinition = $aValues['fields'];
echo sprintf("| %-30.30s | %-50.50s |\n", $aCurrentTaskDefinition['name'], $aCurrentTaskDefinition['description']);
echo sprintf("| %3d | %-84.84s |\n",
$aValues['key'],
$aCurrentTaskDefinition['name'],
);
}
echo "+--------------------------------+----------------------------------------------------+\n";
echo "+-----+--------------------------------------------------------------------------------------+\n";
}
$sMaxVersion = $oRestClient->GetNewestKnownVersion();
echo "iTop REST/API version: $sMaxVersion\n";
Expand Down

0 comments on commit 2d3a901

Please sign in to comment.