Skip to content

Commit

Permalink
argv: refactor clap initialization
Browse files Browse the repository at this point in the history
This commit refactors how we define flags. In theory, this commit
should not result in any behavioral changes (other than perhaps more
consistent rules for flag overrides).

There are two important changes:

Firstly, each flag (or tightly coupled group of flags) is defined in its
own function. This function includes the documentation for that flag. This
improves the locality for each flag; everything you need to know about it
is self-contained in one small region of code.

Secondly, each flag is defined in terms of a very small ripgrep-specific
layer above clap. This permits us to have a set of structured arguments
independent of clap. The intention here is that we can use this indirection
to generate other documentation such as man pages.

This commit lays the ground work for modifying our use of clap in
principled way such that flags can be specified multiple times without
conflict. This in turn will help us implement support for persistent
configuration.
  • Loading branch information
BurntSushi committed Feb 4, 2018
1 parent 115b8a4 commit 64879d9
Showing 1 changed file with 1,331 additions and 543 deletions.
Loading

0 comments on commit 64879d9

Please sign in to comment.