mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 05:53:40 +00:00
[common] option: add preset-only options that don't show up in help
This commit is contained in:
parent
8a2ae6860e
commit
44850f1699
@ -50,6 +50,7 @@ struct Option
|
|||||||
char * name;
|
char * name;
|
||||||
char * description;
|
char * description;
|
||||||
const char shortopt;
|
const char shortopt;
|
||||||
|
bool preset;
|
||||||
|
|
||||||
enum OptionType type;
|
enum OptionType type;
|
||||||
union
|
union
|
||||||
|
@ -663,6 +663,8 @@ void option_print(void)
|
|||||||
for(int i = 0; i < state.groups[g].count; ++i)
|
for(int i = 0; i < state.groups[g].count; ++i)
|
||||||
{
|
{
|
||||||
struct Option * o = state.groups[g].options[i];
|
struct Option * o = state.groups[g].options[i];
|
||||||
|
if (o->preset)
|
||||||
|
continue;
|
||||||
char * value = o->toString(o);
|
char * value = o->toString(o);
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
@ -695,8 +697,10 @@ void option_print(void)
|
|||||||
for(int i = 0; i < state.groups[g].count; ++i)
|
for(int i = 0; i < state.groups[g].count; ++i)
|
||||||
{
|
{
|
||||||
struct Option * o = state.groups[g].options[i];
|
struct Option * o = state.groups[g].options[i];
|
||||||
char * value = stringlist_at(values, i);
|
if (o->preset)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char * value = stringlist_at(values, i);
|
||||||
len = alloc_sprintf(
|
len = alloc_sprintf(
|
||||||
&line,
|
&line,
|
||||||
"%s:%-*s | %c%c | %-*s | %s",
|
"%s:%-*s | %c%c | %-*s | %s",
|
||||||
@ -718,6 +722,12 @@ void option_print(void)
|
|||||||
|
|
||||||
stringlist_free(&values);
|
stringlist_free(&values);
|
||||||
|
|
||||||
|
if (stringlist_count(lines) <= 1)
|
||||||
|
{
|
||||||
|
stringlist_free(&lines);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// print out the lines
|
// print out the lines
|
||||||
for(int i = 0; i < stringlist_count(lines); ++i)
|
for(int i = 0; i < stringlist_count(lines); ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user