diff options
author | Andrew Gallant <jamslam@gmail.com> | 2018-08-29 20:53:52 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2018-09-04 23:18:55 -0400 |
commit | 4846d63539690047fa58ec582d94bcba16da1c09 (patch) | |
tree | 61a2cf9de3d62ea6524659893ab9a2c7800c3286 /src/app.rs | |
parent | 13c47530a6e685d2dee1953a64f055936e6a2ba8 (diff) |
grep-cli: introduce new grep-cli crate
This commit moves a lot of "utility" code from ripgrep core into
grep-cli. Any one of these things might not be worth creating a new
crate, but combining everything together results in a fair number of a
convenience routines that make up a decent sized crate.
There is potentially more we could move into the crate, but much of what
remains in ripgrep core is almost entirely dealing with the number of
flags we support.
In the course of doing moving things to the grep-cli crate, we clean up
a lot of gunk and improve failure modes in a number of cases. In
particular, we've fixed a bug where other processes could deadlock if
they write too much to stderr.
Fixes #990
Diffstat (limited to 'src/app.rs')
-rw-r--r-- | src/app.rs | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -80,7 +80,7 @@ pub fn app() -> App<'static, 'static> { /// Return the "long" format of ripgrep's version string. /// /// If a revision hash is given, then it is used. If one isn't given, then -/// the RIPGREP_BUILD_GIT_HASH env var is inspect for it. If that isn't set, +/// the RIPGREP_BUILD_GIT_HASH env var is inspected for it. If that isn't set, /// then a revision hash is not included in the version string returned. pub fn long_version(revision_hash: Option<&str>) -> String { // Do we have a git hash? @@ -537,7 +537,11 @@ pub fn all_args_and_flags() -> Vec<RGArg> { // The positional arguments must be defined first and in order. arg_pattern(&mut args); arg_path(&mut args); - // Flags can be defined in any order, but we do it alphabetically. + // Flags can be defined in any order, but we do it alphabetically. Note + // that each function may define multiple flags. For example, + // `flag_encoding` defines `--encoding` and `--no-encoding`. Most `--no` + // flags are hidden and merely mentioned in the docs of the corresponding + // "positive" flag. flag_after_context(&mut args); flag_before_context(&mut args); flag_byte_offset(&mut args); |