diff --git a/VERSION b/VERSION index 1ae245d7..5980e52f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-183-g0090580a64+1 \ No newline at end of file +a12-184-g5d69d2aba9+1 \ No newline at end of file diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 178c7929..a00e5208 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -6,6 +6,7 @@ include_directories( ) set(SOURCES + src/stringlist.c src/option.c ) diff --git a/common/include/common/option.h b/common/include/common/option.h index fe6abc6d..f6356c58 100644 --- a/common/include/common/option.h +++ b/common/include/common/option.h @@ -17,8 +17,8 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include +#include "common/stringlist.h" enum OptionType { @@ -33,9 +33,9 @@ struct Option; struct Option { - const char * module; - const char * name; - const char * description; + const char * module; + const char * name; + const char * description; enum OptionType type; union @@ -47,9 +47,10 @@ struct Option } value; - bool (*parser )(struct Option * opt, const char * str); - bool (*validator)(struct Option * opt, const char ** error); - char * (*toString )(struct Option * opt); + bool (*parser )(struct Option * opt, const char * str); + bool (*validator)(struct Option * opt, const char ** error); + char * (*toString )(struct Option * opt); + StringList (*getValues)(struct Option * opt); void (*printHelp)(); }; diff --git a/common/src/option.c b/common/src/option.c index 12ad0628..23dc14c2 100644 --- a/common/src/option.c +++ b/common/src/option.c @@ -464,6 +464,15 @@ bool option_validate() if (error) printf("\n Error: %s\n", error); + if (o->getValues) + { + StringList values = o->getValues(o); + printf("\nValid values are:\n\n"); + for(unsigned int v = 0; v < stringlist_count(values); ++v) + printf(" * %s\n", stringlist_at(values, v)); + stringlist_free(&values); + } + if (o->printHelp) { printf("\n");