mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 01:30:21 -07:00
argv: refactor clap initialization
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.
This commit is contained in:
parent
c8e755f11f
commit
ce84e1ef04
1878
src/app.rs
1878
src/app.rs
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user