| 793 | } |
| 794 | |
| 795 | static void show_negated_gitcomp(const struct option *opts, int show_all, |
| 796 | int nr_noopts) |
| 797 | { |
| 798 | int printed_dashdash = 0; |
| 799 | |
| 800 | for (; opts->type != OPTION_END; opts++) { |
| 801 | int has_unset_form = 0; |
| 802 | const char *name; |
| 803 | |
| 804 | if (!opts->long_name) |
| 805 | continue; |
| 806 | if (!show_all && |
| 807 | (opts->flags & (PARSE_OPT_HIDDEN | PARSE_OPT_NOCOMPLETE))) |
| 808 | continue; |
| 809 | if (opts->flags & PARSE_OPT_NONEG) |
| 810 | continue; |
| 811 | |
| 812 | switch (opts->type) { |
| 813 | case OPTION_STRING: |
| 814 | case OPTION_FILENAME: |
| 815 | case OPTION_INTEGER: |
| 816 | case OPTION_UNSIGNED: |
| 817 | case OPTION_CALLBACK: |
| 818 | case OPTION_BIT: |
| 819 | case OPTION_NEGBIT: |
| 820 | case OPTION_COUNTUP: |
| 821 | case OPTION_SET_INT: |
| 822 | has_unset_form = 1; |
| 823 | break; |
| 824 | default: |
| 825 | break; |
| 826 | } |
| 827 | if (!has_unset_form) |
| 828 | continue; |
| 829 | |
| 830 | if (skip_prefix(opts->long_name, "no-", &name)) { |
| 831 | if (nr_noopts < 0) |
| 832 | printf(" --%s", name); |
| 833 | } else if (nr_noopts >= 0) { |
| 834 | if (nr_noopts && !printed_dashdash) { |
| 835 | printf(" --"); |
| 836 | printed_dashdash = 1; |
| 837 | } |
| 838 | printf(" --no-%s", opts->long_name); |
| 839 | nr_noopts++; |
| 840 | } |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | static int show_gitcomp(const struct option *opts, int show_all) |
| 845 | { |