1313#include <string.h>
1414#include <stdbool.h>
1515#include "desktop.h"
16+ #include "ignore.h"
1617#include "schema.h"
1718
1819static bool no_duplicates ;
@@ -23,6 +24,7 @@ static bool pipemenu;
2324static const struct option long_options [] = {
2425 {"bare" , no_argument , NULL , 'b' },
2526 {"help" , no_argument , NULL , 'h' },
27+ {"ignore" , required_argument , NULL , 'i' },
2628 {"no-duplicates" , no_argument , NULL , 'n' },
2729 {"pipemenu" , no_argument , NULL , 'p' },
2830 {0 , 0 , 0 , 0 }
@@ -32,6 +34,7 @@ static const char labwc_menu_generator_usage[] =
3234"Usage: labwc-menu-generator [options...]\n"
3335" -b, --bare Show no header or footer\n"
3436" -h, --help Show help message and quit\n"
37+ " -i, --ignore <file> Specify file listing .desktop files to ignore\n"
3538" -n, --no-duplicates Limit desktop entries to one directory only\n"
3639" -p, --pipemenu Output in pipemenu format\n" ;
3740
@@ -284,7 +287,7 @@ main(int argc, char **argv)
284287 int c ;
285288 while (1 ) {
286289 int index = 0 ;
287- c = getopt_long (argc , argv , "bhnp " , long_options , & index );
290+ c = getopt_long (argc , argv , "bhi:np " , long_options , & index );
288291 if (c == -1 ) {
289292 break ;
290293 }
@@ -293,6 +296,9 @@ main(int argc, char **argv)
293296 no_footer = true;
294297 no_header = true;
295298 break ;
299+ case 'i' :
300+ ignore_init (optarg );
301+ break ;
296302 case 'n' :
297303 no_duplicates = true;
298304 break ;
@@ -315,6 +321,7 @@ main(int argc, char **argv)
315321
316322 desktop_entries_destroy (apps );
317323 directory_entries_destroy (dirs );
324+ ignore_finish ();
318325
319326 return 0 ;
320327}
0 commit comments