Skip to content
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

Switch from Docopt to Clap. #233

Merged
merged 1 commit into from
Nov 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ matrix:
env: TARGET=x86_64-apple-darwin
# Minimum Rust supported channel.
- os: linux
rust: 1.9.0
env: TARGET=x86_64-unknown-linux-musl
- os: linux
rust: 1.9.0
rust: 1.11.0
env: TARGET=x86_64-unknown-linux-gnu
- os: osx
rust: 1.9.0
rust: 1.11.0
env: TARGET=x86_64-apple-darwin

before_install:
Expand Down
78 changes: 58 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ readme = "README.md"
keywords = ["regex", "grep", "egrep", "search", "pattern"]
license = "Unlicense/MIT"
exclude = ["HomebrewFormula"]
build = "build.rs"

[[bin]]
bench = false
Expand All @@ -25,8 +26,8 @@ path = "tests/tests.rs"

[dependencies]
bytecount = "0.1.4"
clap = "2.18"
ctrlc = "2.0"
docopt = "0.6"
env_logger = "0.3"
grep = { version = "0.1.4", path = "grep" }
ignore = { version = "0.1.5", path = "ignore" }
Expand All @@ -37,13 +38,16 @@ memchr = "0.1"
memmap = "0.5"
num_cpus = "1"
regex = "0.1.77"
rustc-serialize = "=0.3.19"
term = "0.4"

[target.'cfg(windows)'.dependencies]
kernel32-sys = "0.2"
winapi = "0.2"

[build-dependencies]
clap = "2.18"
lazy_static = "0.2"

[features]
avx-accel = ["bytecount/avx-accel"]
simd-accel = ["bytecount/simd-accel", "regex/simd-accel"]
Expand Down
23 changes: 23 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#[macro_use]
extern crate clap;
#[macro_use]
extern crate lazy_static;

use std::fs;

use clap::Shell;

#[allow(dead_code)]
#[path = "src/app.rs"]
mod app;

fn main() {
fs::create_dir_all(env!("OUT_DIR")).unwrap();

let mut app = app::app_short();
app.gen_completions("rg", Shell::Bash, env!("OUT_DIR"));
app.gen_completions("rg", Shell::Fish, env!("OUT_DIR"));
// Zsh seems to fail with a panic.
// app.gen_completions("rg", Shell::Zsh, env!("OUT_DIR"));
app.gen_completions("rg", Shell::PowerShell, env!("OUT_DIR"));
}
1 change: 1 addition & 0 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mk_tarball() {

cp target/$TARGET/release/rg "$td/$name/"
cp {doc/rg.1,README.md,UNLICENSE,COPYING,LICENSE-MIT} "$td/$name/"
cp target/$TARGET/release/build/ripgrep-*/out/{_rg.,rg.}* "$td/$name/"

pushd $td
tar czf "$out_dir/$name.tar.gz" *
Expand Down
25 changes: 22 additions & 3 deletions doc/rg.1
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
rg \- recursively search current directory for lines matching a pattern
.SH SYNOPSIS
.PP
rg [\f[I]options\f[]] \-e PATTERN ...
[\f[I]<\f[]path\f[I]> ...\f[]]
.PP
rg [\f[I]options\f[]] <\f[I]pattern\f[]> [\f[I]<\f[]path\f[I]> ...\f[]]
.PP
rg [\f[I]options\f[]] (\-e PATTERN | \-f FILE) ...
[\f[I]<\f[]path\f[I]> ...\f[]]
.PP
rg [\f[I]options\f[]] \-\-files [\f[I]<\f[]path\f[I]> ...\f[]]
.PP
rg [\f[I]options\f[]] \-\-type\-list
Expand Down Expand Up @@ -163,6 +163,15 @@ Show debug messages.
.RS
.RE
.TP
.B \-f, \-\-file FILE ...
Search for patterns from the given file, with one pattern per line.
When this flag is used or multiple times or in combination with the
\-e/\-\-regexp flag, then all patterns provided are searched.
Empty pattern lines will match all input lines, and the newline is not
counted as part of the pattern.
.RS
.RE
.TP
.B \-\-files
Print each file that would be searched (but don\[aq]t search).
.RS
Expand Down Expand Up @@ -202,6 +211,16 @@ Search hidden directories and files.
.RS
.RE
.TP
.B \-\-ignore\-file FILE ...
Specify additional ignore files for filtering file paths.
Ignore files should be in the gitignore format and are matched relative
to the current working directory.
These ignore files have lower precedence than all other ignore files.
When specifying multiple ignore files, earlier files have lower
precedence than later files.
.RS
.RE
.TP
.B \-L, \-\-follow
Follow symlinks.
.RS
Expand Down
18 changes: 16 additions & 2 deletions doc/rg.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ rg - recursively search current directory for lines matching a pattern

# SYNOPSIS

rg [*options*] -e PATTERN ... [*<*path*> ...*]

rg [*options*] <*pattern*> [*<*path*> ...*]

rg [*options*] (-e PATTERN | -f FILE) ... [*<*path*> ...*]

rg [*options*] --files [*<*path*> ...*]

rg [*options*] --type-list
Expand Down Expand Up @@ -107,6 +107,12 @@ Project home page: https://github.com/BurntSushi/ripgrep
--debug
: Show debug messages.

-f, --file FILE ...
: Search for patterns from the given file, with one pattern per line. When this
flag is used or multiple times or in combination with the -e/--regexp flag,
then all patterns provided are searched. Empty pattern lines will match all
input lines, and the newline is not counted as part of the pattern.

--files
: Print each file that would be searched (but don't search).

Expand All @@ -132,6 +138,14 @@ Project home page: https://github.com/BurntSushi/ripgrep
: Search hidden directories and files. (Hidden directories and files are
skipped by default.)

--ignore-file FILE ...
: Specify additional ignore files for filtering file paths.
Ignore files should be in the gitignore format and are matched
relative to the current working directory. These ignore files
have lower precedence than all other ignore files. When
specifying multiple ignore files, earlier files have lower
precedence than later files.

-L, --follow
: Follow symlinks.

Expand Down
Loading