builtin/sparse-checkout.c: let parse-options parse subcommands
commit1c3502b198a211031619ce22870490b1498c15dd
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 19 Aug 2022 16:04:09 +0000 (19 18:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2022 18:13:16 +0000 (19 11:13 -0700)
tree220e4fdb4b630e1a43b86fda3214d8018c7d7cdd
parentb26a412f1e96e40c419001991486cced837679a6
builtin/sparse-checkout.c: let parse-options parse subcommands

'git sparse-checkout' parses its subcommands with a couple of if
statements.  parse-options has just learned to parse subcommands, so
let's use that facility instead, with the benefits of shorter code,
handling missing or unknown subcommands, and listing subcommands for
Bash completion.

Note that some of the functions implementing each subcommand only
accept the 'argc' and '**argv' parameters, so add a (unused) '*prefix'
parameter to make them match the type expected by parse-options, and
thus avoid casting function pointers.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/sparse-checkout.c