Helptext changes

This commit is contained in:
x3 2023-08-08 21:50:37 +02:00
parent d6fc97a87d
commit 1fb7a4b2fa
Signed by: x3
GPG Key ID: 7E9961E8AD0E240E
2 changed files with 11 additions and 4 deletions

View File

@ -62,12 +62,12 @@ static struct conf_entry modify_add_subopts[] = {
{ .l_name = "watched", .s_name = 'w', .has_arg = no_argument, { .l_name = "watched", .s_name = 'w', .has_arg = no_argument,
.set_func = config_set_bool, .in_args = true, .set_func = config_set_bool, .in_args = true,
.type = OTYPE_B, .handle_order = 0, .value_is_set = true, .type = OTYPE_B, .handle_order = 0, .value_is_set = true,
.h_desc = "Mark the episode as watched when adding files", }, .h_desc = "Mark the episode as watched when adding/modifying files", },
{ .l_name = "wdate", .s_name = UCHAR_MAX + 4, .has_arg = required_argument, { .l_name = "wdate", .s_name = UCHAR_MAX + 4, .has_arg = required_argument,
.set_func = config_set_str, .in_args = true, .set_func = config_set_str, .in_args = true,
.type = OTYPE_S, .handle_order = 0, .type = OTYPE_S, .handle_order = 0,
.h_desc = "Set the watched date when adding files", }, .h_desc = "Set the watched date when adding/modifying files", },
}; };
static struct conf_entry options[] = { static struct conf_entry options[] = {
@ -164,6 +164,9 @@ static struct conf_entry options[] = {
.has_arg = no_argument, .set_func = config_set_bool, .in_args = true, .has_arg = no_argument, .set_func = config_set_bool, .in_args = true,
.type = OTYPE_SUBCOMMAND, .handle_order = 1, .type = OTYPE_SUBCOMMAND, .handle_order = 1,
.h_desc = "Modify files in your anidb list", .h_desc = "Modify files in your anidb list",
.h_desc_more =
"The arguments are either mylist id's, a file/folder path, or file sizes and names\n"
"in the format '[watch_date/]<size>/<filename>'. The filename can't contain '/' characters\n",
.subopts = modify_add_subopts, .subopts = modify_add_subopts,
.subopts_count = sizeof(modify_add_subopts) / sizeof(modify_add_subopts[0]), .subopts_count = sizeof(modify_add_subopts) / sizeof(modify_add_subopts[0]),
}, },
@ -225,7 +228,8 @@ static int config_read_args(int argc, char **argv,
char sopt[opts_count * 2 + 1], struct option lopt[opts_count + 1], int level) char sopt[opts_count * 2 + 1], struct option lopt[opts_count + 1], int level)
{ {
int optc, err = NOERR; int optc, err = NOERR;
optind = 1; /* Reinitialize getopt with 0 here */
optind = 0;
//uio_debug("Before %d %s", argc, argv[0]); //uio_debug("Before %d %s", argc, argv[0]);
while ((optc = getopt_long(argc, argv, sopt, while ((optc = getopt_long(argc, argv, sopt,
@ -479,10 +483,12 @@ static int show_subcomm_help(struct conf_entry *ce)
printf( printf(
"Usage: caniadd [OPTIONS] %s [SUBCOMMAND_OPTIONS]\n" "Usage: caniadd [OPTIONS] %s [SUBCOMMAND_OPTIONS]\n"
"%s\n" "%s\n"
"%s"
"\n" "\n"
"SUBCOMMAND_OPTIONS:\n", "SUBCOMMAND_OPTIONS:\n",
current_subcommand->l_name, current_subcommand->l_name,
current_subcommand->h_desc current_subcommand->h_desc,
current_subcommand->h_desc_more ? current_subcommand->h_desc_more : ""
); );
for (size_t i = 0; i < current_subcommand->subopts_count; i++) { for (size_t i = 0; i < current_subcommand->subopts_count; i++) {

View File

@ -50,6 +50,7 @@ struct conf_entry {
const char *l_name; /* The long name for the option, or for the config file */ const char *l_name; /* The long name for the option, or for the config file */
int s_name; /* Short option name */ int s_name; /* Short option name */
const char *h_desc; /* Description for the help screen */ const char *h_desc; /* Description for the help screen */
const char *h_desc_more; /* More description for the help screen */
union { /* Value of the param */ union { /* Value of the param */
char *s; char *s;
uint16_t hu; uint16_t hu;