virsh: Implement new table API for virsh list

Instead of printing it straight in virsh, it creates table struct
which is filled with header and rows(domains). It allows us to know
more about table before printing to calculate alignment right.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
This commit is contained in:
Simon Kobyda
2018-08-24 10:53:20 +02:00
committed by Michal Privoznik
parent 9417f0b3f6
commit 2e97450425
2 changed files with 31 additions and 26 deletions
+7 -7
View File
@@ -98,9 +98,9 @@ static int testCompareListDefault(const void *data ATTRIBUTE_UNUSED)
{
const char *const argv[] = { VIRSH_DEFAULT, "list", NULL };
const char *exp = "\
Id Name State\n\
----------------------------------------------------\n\
1 test running\n\
Id Name State \n\
----------------------\n\
1 test running \n\
\n";
return testCompareOutputLit(exp, NULL, argv);
}
@@ -109,10 +109,10 @@ static int testCompareListCustom(const void *data ATTRIBUTE_UNUSED)
{
const char *const argv[] = { VIRSH_CUSTOM, "list", NULL };
const char *exp = "\
Id Name State\n\
----------------------------------------------------\n\
1 fv0 running\n\
2 fc4 running\n\
Id Name State \n\
----------------------\n\
1 fv0 running \n\
2 fc4 running \n\
\n";
return testCompareOutputLit(exp, NULL, argv);
}