mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] fix option output counts and dynamic name padding
This commit is contained in:
parent
c38e38d43d
commit
f4b95eeda9
@ -1096,13 +1096,31 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
if (strcasecmp(optarg, "list") == 0)
|
if (strcasecmp(optarg, "list") == 0)
|
||||||
{
|
{
|
||||||
|
size_t maxLen = 0;
|
||||||
|
for(unsigned int i = 0; i < LG_RENDERER_COUNT; ++i)
|
||||||
|
{
|
||||||
|
const LG_Renderer * r = LG_Renderers[i];
|
||||||
|
for(unsigned int j = 0; j < r->option_count; ++j)
|
||||||
|
{
|
||||||
|
const size_t len = strlen(r->options[j].name);
|
||||||
|
if (len > maxLen)
|
||||||
|
maxLen = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\nRenderer Option List\n");
|
fprintf(stderr, "\nRenderer Option List\n");
|
||||||
for(unsigned int i = 0; i < LG_RENDERER_COUNT; ++i)
|
for(unsigned int i = 0; i < LG_RENDERER_COUNT; ++i)
|
||||||
{
|
{
|
||||||
const LG_Renderer * r = LG_Renderers[i];
|
const LG_Renderer * r = LG_Renderers[i];
|
||||||
fprintf(stderr, "\n%s\n", r->get_name());
|
fprintf(stderr, "\n%s\n", r->get_name());
|
||||||
for(unsigned int i = 0; i < r->option_count; ++i)
|
for(unsigned int j = 0; j < r->option_count; ++j)
|
||||||
fprintf(stderr, " %10s - %s\n", r->options[i].name, r->options[i].desc);
|
{
|
||||||
|
const size_t pad = maxLen - strlen(r->options[j].name);
|
||||||
|
for(int i = 0; i < pad; ++i)
|
||||||
|
fputc(' ', stderr);
|
||||||
|
|
||||||
|
fprintf(stderr, " %s - %s\n", r->options[j].name, r->options[j].desc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user