1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[Script] Print list of user scripts in -h

This commit is contained in:
Dave Davenport 2022-06-12 17:49:04 +02:00
parent ffa1d11e3c
commit 40ecfcd1f1
3 changed files with 18 additions and 0 deletions

View file

@ -64,5 +64,11 @@ void script_mode_gather_user_scripts(void);
* Cleanup memory allocated by `script_mode_gather_user_scripts` * Cleanup memory allocated by `script_mode_gather_user_scripts`
*/ */
void script_mode_cleanup(void); void script_mode_cleanup(void);
/**
* @param is_term if printed to terminal
*
* List the user scripts found.
*/
void script_user_list(gboolean is_term);
/**@}*/ /**@}*/
#endif // ROFI_MODE_SCRIPT_H #endif // ROFI_MODE_SCRIPT_H

View file

@ -552,3 +552,12 @@ gboolean script_mode_is_valid(const char *token) {
} }
return strchr(token, ':') != NULL; return strchr(token, ':') != NULL;
} }
void script_user_list(gboolean is_term) {
for (unsigned int i = 0; i < num_scripts; i++) {
printf(" • %s%s%s (%s)\n", is_term ? (color_bold) : "",
user_scripts[i].name, is_term ? color_reset : "",
user_scripts[i].path);
}
}

View file

@ -327,6 +327,9 @@ static void help(G_GNUC_UNUSED int argc, char **argv) {
printf("Detected modes:\n"); printf("Detected modes:\n");
print_list_of_modes(is_term); print_list_of_modes(is_term);
printf("\n"); printf("\n");
printf("Detected user scripts:\n");
script_user_list(is_term);
printf("\n");
printf("Compile time options:\n"); printf("Compile time options:\n");
#ifdef WINDOW_MODE #ifdef WINDOW_MODE
printf("\t• window %senabled%s\n", is_term ? color_green : "", printf("\t• window %senabled%s\n", is_term ? color_green : "",