diff --git a/README.md b/README.md index 1a302928..a4c156d6 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,10 @@ The Pizza Test CLI provides an efficient way to run and manage tests directly fr | `--only ` | Run only the specified test. | Focuses execution on a single test for debugging or validation purposes. | | `--repeat ` | Repeat the test a specified number of times. | Useful for stress testing or verifying consistency across multiple runs. | | `--help` | Show help for the run command. | Provides detailed usage instructions for the `run` command. | - ### Filter Command Options | Option | Description | Notes | |----------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| +| `--options` | Show all available filter options. | Provides a comprehensive list of filter-related flags and their usage. | | `--test-name ` | Filter by test name. | Enables precise targeting of individual tests. | | `--suite-name `| Filter by suite name. | Useful for running all tests within a specific suite. | | `--tag ` | Filter by tag. | Allows grouping and execution of tests based on custom tags. | @@ -98,6 +98,7 @@ The Pizza Test CLI provides an efficient way to run and manage tests directly fr ### Sort Command Options | Option | Description | Notes | |----------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| +| `--options` | Show all available sort options. | Provides a comprehensive list of sort-related flags and their usage. | | `--by ` | Sort by specified criteria. | Common criteria include execution time, name, or priority. | | `--order ` | Sort in ascending or descending order. | Helps organize test execution based on preferred order. | | `--help` | Show help for the sort command. | Provides detailed usage instructions for the `sort` command. | @@ -105,6 +106,7 @@ The Pizza Test CLI provides an efficient way to run and manage tests directly fr ### Shuffle Command Options | Option | Description | |----------------------|-----------------------------------------------------------------------------------------------| +| `--options` | Show all available shuffle options. | | `--seed ` | Specify the seed for shuffling. | | `--count ` | Number of items to shuffle. | | `--by ` | Shuffle by specified criteria. | diff --git a/code/logic/common.c b/code/logic/common.c index bb134d65..cf314370 100644 --- a/code/logic/common.c +++ b/code/logic/common.c @@ -108,6 +108,7 @@ static void _show_subhelp_filter(void) { pizza_io_printf("{cyan} --suite-name Filter by suite name{reset}\n"); pizza_io_printf("{cyan} --tag Filter by tag{reset}\n"); pizza_io_printf("{cyan} --help Show help for filter command{reset}\n"); + pizza_io_printf("{cyan} --options Show all valid tags{reset}\n"); exit(EXIT_SUCCESS); } @@ -116,6 +117,7 @@ static void _show_subhelp_sort(void) { pizza_io_printf("{cyan} --by Sort by specified criteria{reset}\n"); pizza_io_printf("{cyan} --order Sort in ascending or descending order{reset}\n"); pizza_io_printf("{cyan} --help Show help for sort command{reset}\n"); + pizza_io_printf("{cyan} --options Show all valid criteria{reset}\n"); exit(EXIT_SUCCESS); } @@ -125,6 +127,7 @@ static void _show_subhelp_shuffle(void) { pizza_io_printf("{cyan} --count Number of items to shuffle{reset}\n"); pizza_io_printf("{cyan} --by Shuffle by specified criteria{reset}\n"); pizza_io_printf("{cyan} --help Show help for shuffle command{reset}\n"); + pizza_io_printf("{cyan} --options Show all valid criteria for shuffling{reset}\n"); exit(EXIT_SUCCESS); } @@ -254,6 +257,12 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv) { } } else if (pizza_io_cstr_compare(argv[j], "--help") == 0) { _show_subhelp_filter(); + } else if (pizza_io_cstr_compare(argv[j], "--options") == 0) { + pizza_io_printf("{blue}Valid tags:{reset}\n"); + for (int k = 0; VALID_TAGS[k] != null; k++) { + pizza_io_printf("{cyan} %s{reset}\n", VALID_TAGS[k]); + } + exit(EXIT_SUCCESS); } else { break; } @@ -282,6 +291,12 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv) { pallet.sort.order = argv[++j]; } else if (pizza_io_cstr_compare(argv[j], "--help") == 0) { _show_subhelp_sort(); + } else if (pizza_io_cstr_compare(argv[j], "--options") == 0) { + pizza_io_printf("{blue}Valid criteria:{reset}\n"); + for (int k = 0; VALID_CRITERIA[k] != null; k++) { + pizza_io_printf("{cyan} %s{reset}\n", VALID_CRITERIA[k]); + } + exit(EXIT_SUCCESS); } else { break; } @@ -292,17 +307,23 @@ fossil_pizza_pallet_t fossil_pizza_pallet_create(int argc, char** argv) { pallet.shuffle.by = null; for (int j = i + 1; j < argc; j++) { - if (pizza_io_cstr_compare(argv[j], "--seed") == 0 && j + 1 < argc) { - pallet.shuffle.seed = argv[++j]; - } else if (pizza_io_cstr_compare(argv[j], "--count") == 0 && j + 1 < argc) { - pallet.shuffle.count = atoi(argv[++j]); - } else if (pizza_io_cstr_compare(argv[j], "--by") == 0 && j + 1 < argc) { - pallet.shuffle.by = argv[++j]; - } else if (pizza_io_cstr_compare(argv[j], "--help") == 0) { - _show_subhelp_shuffle(); - } else { - break; + if (pizza_io_cstr_compare(argv[j], "--seed") == 0 && j + 1 < argc) { + pallet.shuffle.seed = argv[++j]; + } else if (pizza_io_cstr_compare(argv[j], "--count") == 0 && j + 1 < argc) { + pallet.shuffle.count = atoi(argv[++j]); + } else if (pizza_io_cstr_compare(argv[j], "--by") == 0 && j + 1 < argc) { + pallet.shuffle.by = argv[++j]; + } else if (pizza_io_cstr_compare(argv[j], "--help") == 0) { + _show_subhelp_shuffle(); + } else if (pizza_io_cstr_compare(argv[j], "--options") == 0) { + pizza_io_printf("{blue}Valid criteria for shuffling:{reset}\n"); + for (int k = 0; VALID_CRITERIA[k] != null; k++) { + pizza_io_printf("{cyan} %s{reset}\n", VALID_CRITERIA[k]); } + exit(EXIT_SUCCESS); + } else { + break; + } } } else if (strncmp(argv[i], "color=", 6) == 0) { if (pizza_io_cstr_compare(argv[i] + 6, "enable") == 0) {