Skip to content
Extraits de code Groupes Projets
Vérifiée Valider b0d97f90 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Adding printing of subcommands help

parent b80455f2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!64Resolve "Installation"
......@@ -18,7 +18,7 @@ struct lkt_cmd_opt {
const char *name;
lkt_cmd_callback call;
const char *help;
int sub;
struct lkt_cmd_opt *sub;
};
/* Parse the command line with the list of options. No parameter may be NULL.
......
......@@ -84,4 +84,14 @@ lkt_cmd_help(struct lkt_cmd_opt *opts, const char *name)
printf("\t%*s %s\n", max_len, it->name, it->help);
it = opts + (++offset);
}
/* Prints the sub commands help */
it = opts;
offset = 0;
write(1, "\n", sizeof(char));
while (it && it->name) {
if (it->sub)
lkt_cmd_help(it->sub, it->name);
it = opts + (++offset);
}
}
......@@ -292,7 +292,7 @@ init__(struct lkt_cmd_args *args)
}
static struct lkt_cmd_opt options[] = {
{ .name = "init", .call = init__, .help = "The init sub-command", .sub = 1 },
{ .name = "init", .call = init__, .help = "The init sub-command", .sub = options_init },
{ .name = "get", .call = get__, .help = "Get the mdt of a kara by its id" },
{ .name = "download", .call = download__, .help = "Download a kara by its id" },
{ .name = "cat", .call = cat__, .help = "Prints the mdt of a kara on the fs" },
......
......@@ -156,17 +156,14 @@ loop:
break;
case SDL_WINDOWEVENT:
if (event.window.event == SDL_WINDOWEVENT_EXPOSED) {
fprintf(stderr, " . sdl_thread__: Window exposed\n");
if (event.window.event == SDL_WINDOWEVENT_EXPOSED)
redraw = 1;
}
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_SPACE) {
const char *cmd_pause[] = { "cycle", "pause", NULL };
mpv_command_async((mpv_handle *) sdl2->mpv, 0, cmd_pause);
fprintf(stderr, " . sdl_thread__: Toggle pause\n");
}
break;
......@@ -178,7 +175,6 @@ loop:
SDL_SetWindowFullscreen((SDL_Window *) sdl2->window, SDL_WINDOW_FULLSCREEN);
/* May use SDL_WINDOW_FULLSCREEN_DESKTOP, need to check. */
sdl2->is_fullscreen = 1 - sdl2->is_fullscreen;
fprintf(stderr, " . sdl_thread__: Toggle fullscreen\n");
}
break;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter