@@ -35,7 +35,6 @@ const char* G_PIZZA_ONLY = null;
3535int G_PIZZA_REPEAT = 0 ;
3636int G_PIZZA_THREADS = 1 ;
3737fossil_pizza_cli_theme_t G_PIZZA_THEME = PIZZA_THEME_FOSSIL ;
38- fossil_pizza_cli_verbose_t G_PIZZA_VERBOSE = PIZZA_VERBOSE_PLAIN ;
3938
4039// *****************************************************************************
4140// command pallet
@@ -61,8 +60,6 @@ static const char* VALID_CRITERIA[] = {
6160 null // Sentinel to mark the end
6261};
6362
64- // TODO add --options flag to show all options for commands that take options such as color or theme
65-
6663static void _show_help (void ) {
6764 pizza_io_printf ("{blue}Usage: pizza [options] [command]{reset}\n" );
6865 pizza_io_printf ("{blue}Options:{reset}\n" );
@@ -75,10 +72,10 @@ static void _show_help(void) {
7572 pizza_io_printf ("{cyan} filter Filter tests based on criteria{reset}\n" );
7673 pizza_io_printf ("{cyan} sort Sort tests by specified criteria{reset}\n" );
7774 pizza_io_printf ("{cyan} shuffle Shuffle tests with optional parameters{reset}\n" );
75+ pizza_io_printf ("{cyan} show Show test cases with optional parameters{reset}\n" );
7876 pizza_io_printf ("{cyan} color=<mode> Set color mode (enable, disable, auto){reset}\n" );
7977 pizza_io_printf ("{cyan} config=<file> Specify a configuration file (must be pizza_test.ini){reset}\n" );
8078 pizza_io_printf ("{cyan} theme=<name> Set the theme (fossil, catch, doctest, etc.){reset}\n" );
81- pizza_io_printf ("{cyan} verbose=<level> Set verbosity level (plain, ci, doge){reset}\n" );
8279 pizza_io_printf ("{cyan} timeout=<seconds> Set the timeout for commands (default: 60 seconds){reset}\n" );
8380 exit (EXIT_SUCCESS );
8481}
@@ -155,11 +152,14 @@ static void _show_subhelp_theme(void) {
155152 exit (EXIT_SUCCESS );
156153}
157154
158- static void _show_subhelp_verbose (void ) {
159- pizza_io_printf ("{blue}Verbose command options:{reset}\n" );
160- pizza_io_printf ("{cyan} plain Plain output{reset}\n" );
161- pizza_io_printf ("{cyan} ci Continuous Integration output{reset}\n" );
162- pizza_io_printf ("{cyan} doge High-transparency verbose output{reset}\n" );
155+ static void _show_subhelp_show (void ) {
156+ pizza_io_printf ("{blue}Show command options:{reset}\n" );
157+ pizza_io_printf ("{cyan} --test-name <name> Filter by test name{reset}\n" );
158+ pizza_io_printf ("{cyan} --suite-name <name> Filter by suite name{reset}\n" );
159+ pizza_io_printf ("{cyan} --tag <tag> Filter by tag{reset}\n" );
160+ pizza_io_printf ("{cyan} --result <result> Filter by result (pass, fail, timeout, skipped, unexpected){reset}\n" );
161+ pizza_io_printf ("{cyan} --verbose <level> Set verbosity level (plain, ci, doge){reset}\n" );
162+ pizza_io_printf ("{cyan} --mode <mode> Show mode (list, tree, graph){reset}\n" );
163163 exit (EXIT_SUCCESS );
164164}
165165
@@ -168,8 +168,6 @@ static void _show_version(void) {
168168 exit (EXIT_SUCCESS );
169169}
170170
171- // TODO add architecture and CPU information
172-
173171static void _show_host (void ) {
174172 pizza_sys_hostinfo_system_t system_info ;
175173 pizza_sys_hostinfo_memory_t memory_info ;
@@ -214,6 +212,8 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv) {
214212 fossil_pizza_pallet_t pallet = {0 };
215213 int is_command = 0 ; // Variable to track if a command is being processed
216214
215+ pallet .show .enabled = 0 ; // Initialize show command enabled flag
216+
217217 // Parse command-line arguments
218218 for (int i = 1 ; i < argc ; i ++ ) {
219219 if (pizza_io_cstr_compare (argv [i ], "--dry-run" ) == 0 ) {
@@ -416,29 +416,57 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv) {
416416 if (i + 1 < argc && pizza_io_cstr_compare (argv [i + 1 ], "--help" ) == 0 ) {
417417 _show_subhelp_theme ();
418418 }
419- } else if (strncmp (argv [i ], "verbose=" , 8 ) == 0 ) {
420- const char * verbose_str = argv [i ] + 8 ;
421- if (pizza_io_cstr_compare (verbose_str , "plain" ) == 0 ) {
422- pallet .verbose = PIZZA_VERBOSE_PLAIN ;
423- G_PIZZA_VERBOSE = PIZZA_VERBOSE_PLAIN ;
424- } else if (pizza_io_cstr_compare (verbose_str , "ci" ) == 0 ) {
425- pallet .verbose = PIZZA_VERBOSE_CI ;
426- G_PIZZA_VERBOSE = PIZZA_VERBOSE_CI ;
427- } else if (pizza_io_cstr_compare (verbose_str , "doge" ) == 0 ) {
428- pallet .verbose = PIZZA_VERBOSE_DOGE ;
429- G_PIZZA_VERBOSE = PIZZA_VERBOSE_DOGE ;
430- }
431- } else if (pizza_io_cstr_compare (argv [i ], "verbose" ) == 0 ) {
432- if (i + 1 < argc && pizza_io_cstr_compare (argv [i + 1 ], "--help" ) == 0 ) {
433- _show_subhelp_verbose ();
434- }
435419 } else if (strncmp (argv [i ], "timeout=" , 8 ) == 0 ) {
436420 G_PIZZA_TIMEOUT = atoi (argv [i ] + 8 );
437421 } else if (pizza_io_cstr_compare (argv [i ], "timeout" ) == 0 ) {
438422 if (i + 1 < argc && pizza_io_cstr_compare (argv [i + 1 ], "--help" ) == 0 ) {
439423 _show_help ();
440424 exit (EXIT_SUCCESS );
441425 }
426+ } else if (pizza_io_cstr_compare (argv [i ], "show" ) == 0 ) {
427+ is_command = 1 ;
428+ pallet .show .test_name = null ;
429+ pallet .show .suite_name = null ;
430+ pallet .show .tag = null ;
431+ pallet .show .result = "fail" ;
432+ pallet .show .mode = "list" ;
433+ pallet .show .verbose = "plain" ;
434+ pallet .show .enabled = 1 ; // Default to enabled
435+
436+ for (int j = i + 1 ; j < argc ; j ++ ) {
437+ if (!is_command ) break ;
438+ if (pizza_io_cstr_compare (argv [j ], "--test-name" ) == 0 && j + 1 < argc ) {
439+ pallet .show .test_name = argv [++ j ];
440+ } else if (pizza_io_cstr_compare (argv [j ], "--suite-name" ) == 0 && j + 1 < argc ) {
441+ pallet .show .suite_name = argv [++ j ];
442+ } else if (pizza_io_cstr_compare (argv [j ], "--tag" ) == 0 && j + 1 < argc ) {
443+ pallet .show .tag = argv [++ j ];
444+ } else if (pizza_io_cstr_compare (argv [j ], "--result" ) == 0 && j + 1 < argc ) {
445+ pallet .show .result = argv [++ j ];
446+ } else if (pizza_io_cstr_compare (argv [j ], "--mode" ) == 0 && j + 1 < argc ) {
447+ pallet .show .mode = argv [++ j ];
448+ // Validate mode (should be one of: list, tree, graph)
449+ if (pizza_io_cstr_compare (pallet .show .mode , "list" ) != 0 &&
450+ pizza_io_cstr_compare (pallet .show .mode , "tree" ) != 0 &&
451+ pizza_io_cstr_compare (pallet .show .mode , "graph" ) != 0 ) {
452+ pizza_io_printf ("{red}Error: Invalid mode '%s'. Valid modes are: list, tree, graph.{reset}\n" , pallet .show .mode );
453+ exit (EXIT_FAILURE );
454+ }
455+ } else if (pizza_io_cstr_compare (argv [j ], "--verbose" ) == 0 && j + 1 < argc ) {
456+ pallet .show .verbose = argv [++ j ];
457+ // Validate verbose (should be one of: plain, ci, doge)
458+ if (pizza_io_cstr_compare (pallet .show .verbose , "plain" ) != 0 &&
459+ pizza_io_cstr_compare (pallet .show .verbose , "ci" ) != 0 &&
460+ pizza_io_cstr_compare (pallet .show .verbose , "doge" ) != 0 ) {
461+ pizza_io_printf ("{red}Error: Invalid verbose level '%s'. Valid levels are: plain, ci, doge.{reset}\n" , pallet .show .verbose );
462+ exit (EXIT_FAILURE );
463+ }
464+ } else if (pizza_io_cstr_compare (argv [j ], "--help" ) == 0 ) {
465+ _show_subhelp_show ();
466+ } else {
467+ is_command = 0 ;
468+ }
469+ }
442470 }
443471 }
444472
@@ -535,14 +563,6 @@ int fossil_pizza_ini_parse(const char *filename, fossil_pizza_pallet_t *pallet)
535563 } else if (pizza_io_cstr_compare (value , "unity" ) == 0 ) {
536564 pallet -> theme = PIZZA_THEME_UNITY ;
537565 }
538- } else if (pizza_io_cstr_compare (key , "verbose" ) == 0 ) {
539- if (pizza_io_cstr_compare (value , "plain" ) == 0 ) {
540- pallet -> verbose = PIZZA_VERBOSE_PLAIN ;
541- } else if (pizza_io_cstr_compare (value , "ci" ) == 0 ) {
542- pallet -> verbose = PIZZA_VERBOSE_CI ;
543- } else if (pizza_io_cstr_compare (value , "doge" ) == 0 ) {
544- pallet -> verbose = PIZZA_VERBOSE_DOGE ;
545- }
546566 }
547567 } else if (pizza_io_cstr_compare (section , "test" ) == 0 ) {
548568 if (pizza_io_cstr_compare (key , "run.fail_fast" ) == 0 ) {
0 commit comments