feat: usage in --help
This commit is contained in:
parent
ebb8a91859
commit
51f636bc6b
3 changed files with 7 additions and 2 deletions
|
|
@ -65,4 +65,6 @@ enum { FT_SSL_OPT_LEN = (0 FT_SSL_OPTION_LIST ) };
|
||||||
enum { FT_SSL_OPTSTR_LEN = (2 FT_SSL_OPTION_LIST) };
|
enum { FT_SSL_OPTSTR_LEN = (2 FT_SSL_OPTION_LIST) };
|
||||||
/* +2 for ':' to disable getopt error messages and \0 */
|
/* +2 for ':' to disable getopt error messages and \0 */
|
||||||
|
|
||||||
|
void print_usage(const char *prog);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
#include <cli.h>
|
#include <cli.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
#include "version_gen.h"
|
||||||
#include "internal/cli/option.h"
|
#include "internal/cli/option.h"
|
||||||
#include "internal/cli/cli_handlers.h"
|
#include "internal/cli/cli_handlers.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
cli_handle_help(__unused const char *arg, __unused void *config_void)
|
cli_handle_help(__unused const char *arg, __unused void *config_void)
|
||||||
{
|
{
|
||||||
|
print_usage(g_prog_name);
|
||||||
|
printf("\n");
|
||||||
cli_print_options(g_options, FT_SSL_OPT_LEN, cli_arg_type_to_str);
|
cli_print_options(g_options, FT_SSL_OPT_LEN, cli_arg_type_to_str);
|
||||||
return CLI_EXIT_SUCCESS;
|
return CLI_EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static void init_config(struct ssl_config *config);
|
static void init_config(struct ssl_config *config);
|
||||||
static void print_usage(const char *prog);
|
|
||||||
static const struct digest_algo *find_algo(const char *name);
|
static const struct digest_algo *find_algo(const char *name);
|
||||||
static enum cli_code parse_subcommand(int argc, char **argv, int first_arg,
|
static enum cli_code parse_subcommand(int argc, char **argv, int first_arg,
|
||||||
struct ssl_config *config);
|
struct ssl_config *config);
|
||||||
|
|
@ -70,7 +69,7 @@ find_algo(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
print_usage(const char *prog)
|
print_usage(const char *prog)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue