-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for persistent config #772
Merged
Merged
+2,065
−624
Commits on Feb 4, 2018
-
This commit updates the `log` crate to 0.4 and drops the dependency on env_logger. In particular, the latest version of env_logger brings in additional non-optional dependencies such as chrono that I don't think is worth including into ripgrep. It turns out ripgrep doesn't need any fancy logging. We just need a concept of log levels and the ability to print to stderr. Therefore, we just roll our own super simple logger. This update is motivated by the persistent configuration task. In particular, we need the ability to toggle the global log level more than once, and this doesn't appear to be possible with older versions of the log crate.
Configuration menu - View commit details
-
Copy full SHA for e633d50 - Browse repository at this point
Copy the full SHA e633d50View commit details -
This commit makes the git hash ripgrep was built with available for use in the version string. We also do a few minor touchups in build.rs and src/app.rs.
Configuration menu - View commit details
-
Copy full SHA for a16fc18 - Browse repository at this point
Copy the full SHA a16fc18View commit details -
deps: remove vec-map feature from clap
This removes the vec-map feature from clap. clap's README claims that vec-map provides a small performance benefit, but I could observe any in ripgrep workloads. The benefit here is that it drops a dependency. Amazingly, this drops whole release build times for ripgrep from 68s to 33s, and debug build time also decreases from 22s to 15.5s. This was entirely unintentional but a welcome surprise.
Configuration menu - View commit details
-
Copy full SHA for 115b8a4 - Browse repository at this point
Copy the full SHA 115b8a4View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 64879d9 - Browse repository at this point
Copy the full SHA 64879d9View commit details -
This commit builds on the previous argv refactor by being more principled about how we declared our flags. In particular, we now require that every clap argument is one of three things: a positional argument, a switch or a flag that accepts exactly one value. The latter two are always permitted to be repeated, and we modify the code that consumes a clap::ArgMatches to always use the *last* value of an argument. (clap by default always uses the first value of argument, if it has been repeated and is accessed via one of the singleton accessors.) Fixes #553
Configuration menu - View commit details
-
Copy full SHA for 1a05e3a - Browse repository at this point
Copy the full SHA 1a05e3aView commit details -
config: add persistent configuration
This commit adds support for reading configuration files that change ripgrep's default behavior. The format of the configuration file is an "rc" style and is very simple. It is defined by two rules: 1. Every line is a shell argument, after trimming ASCII whitespace. 2. Lines starting with '#' (optionally preceded by any amount of ASCII whitespace) are ignored. ripgrep will look for a single configuration file if and only if the RIPGREP_CONFIG_PATH environment variable is set and is non-empty. ripgrep will parse shell arguments from this file on startup and will behave as if the arguments in this file were prepended to any explicit arguments given to ripgrep on the command line. For example, if your ripgreprc file contained a single line: --smart-case then the following command RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo would behave identically to the following command rg --smart-case foo This commit also adds a new flag, --no-config, that when present will suppress any and all support for configuration. This includes any future support for auto-loading configuration files from pre-determined paths (which this commit does not add). Conflicts between configuration files and explicit arguments are handled exactly like conflicts in the same command line invocation. That is, this command: RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo --case-sensitive is exactly equivalent to rg --smart-case foo --case-sensitive in which case, the --case-sensitive flag would override the --smart-case flag. Closes #196
Configuration menu - View commit details
-
Copy full SHA for 6838019 - Browse repository at this point
Copy the full SHA 6838019View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.