void exarg_install_arg gchar *  arg_name,
gchar *  arg_short_name,
ExArgType  type,
gchar *  description

Installs a new command line to be accepted.

This functions allows you to install new arguments to be accepted. Every argument passed in to the program which is not installed throught this function will no be accepted and will generate a non recognized command line error.

Let's see an example on how to use exarg to install the --version argument. You should call exarg as follows:

       exarg_install_arg ("version", "v", EXARG_NONE, 
                          "show program version");

Previous line have installed a argument called "version" which will be invoked by the user as --version. The short alias in this case is "v" which as we have see will allow user to invoke your program as -v.

Because you could install arguments which may conflict, this function will abort the program execution on that case. This will ensure you, as programer, to have a binary compiled with no problems due to exarg.

Later on, you can use exarg_is_defined to check the status of installed arguments. Once you install an argument the user may invoke it and you could check that status using previous function. Because the "version" argument type is EXARG_NONE you can only use exarg_is_defined. But, for other argument types as EXARG_STRING, you can also use exarg_get_string function to get the value defined by user. Let's see an example.

       exarg_install_arg ("load-library", "l", EXARG_STRING,
                          "loads the library defined as argument");

This previous line will allow user to invoke your program as --load-library path/to/lib. Then you can use exarg_get_string to get the path/to/lib value by using:

       // check user have defined this argument
       if (exarg_is_defined ("load-library")) {

             arg_value = exarg_get_string ("load-library");

             g_print ("The library defined by user was: %s\n", 

You must install all argument before calling exarg_parse. That function will parse argument options by using installed arguments. Check the info about that function.

ExArg is not thread-safe which doesn't means anything wrong but you must call all exarg function from the same thread to get the right results.

This function will not do a copy from arg_name, arg_short_name or description. This means you should not free that values while using exarg. To end exarg using check exarg_end. It is recomended to use static values and shows on previous examples.