diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4edcbdd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# 0.8.7 (2019-06-15) + +Minor fixes + +- Correctly wrap help text +- Show own help when no arguments given +- Hopefully package the rga binary correctly + +# 0.8.5 + +previous changes not documented diff --git a/Cargo.lock b/Cargo.lock index bc6bd48..f052873 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,6 +150,7 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -420,6 +421,15 @@ name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "1.3.0" @@ -918,7 +928,7 @@ dependencies = [ [[package]] name = "ripgrep_all" -version = "0.8.7-alpha.0" +version = "0.8.7" dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1138,6 +1148,16 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "term_size" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "termcolor" version = "1.0.5" @@ -1162,6 +1182,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1266,6 +1287,11 @@ name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.7" @@ -1275,6 +1301,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1410,6 +1441,7 @@ dependencies = [ "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" "checksum libflate 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "76912aa0196b6f0e06d9c43ee877be45369157c06172ade12fe20ac3ee5ffa15" @@ -1491,6 +1523,7 @@ dependencies = [ "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" "checksum tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7dc4738f2e68ed2855de5ac9cdbe05c9216773ecde4739b2f095002ab03a13ef" +"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" "checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" @@ -1509,7 +1542,9 @@ dependencies = [ "checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index cfe61d8..313cb5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "ripgrep_all" -description = "ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc" +description = "ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc." license = "AGPL-3.0-or-later" -version = "0.8.7-alpha.0" +version = "0.8.7" repository = "https://github.com/phiresky/ripgrep_all" authors = ["phiresky "] edition = "2018" @@ -27,7 +27,7 @@ serde_json = "1.0.39" failure = "0.1.5" zip = "0.5.2" crossbeam = "0.7.1" -clap = "2.33.0" +clap = { version="2.33.0", features=["wrap_help"] } log = "0.4.6" env_logger = "0.6.1" xz2 = "0.1.6" diff --git a/src/args.rs b/src/args.rs index 1dd23dd..6453ea2 100644 --- a/src/args.rs +++ b/src/args.rs @@ -29,7 +29,12 @@ set_default!(cache_max_blob_len, 2000000, u32); set_default!(max_archive_recursion, 4, i32); #[derive(StructOpt, Debug, Deserialize, Serialize)] -#[structopt(rename_all = "kebab-case", set_term_width = 80)] +#[structopt( + rename_all = "kebab-case", + author = "https://github.com/phiresky/ripgrep-all", + // TODO: long_about does not seem to work to only show this on short help + after_help = "-h shows a concise overview, --help shows more detail and advanced options.\n\nAll other options not shown here are passed directly to rg, especially [PATTERN] and [PATH ...]" +)] pub struct RgaArgs { #[serde(default, skip_serializing_if = "is_default")] #[structopt(long = "--rga-no-cache")] @@ -69,7 +74,11 @@ pub struct RgaArgs { default = "def_cache_max_blob_len", skip_serializing_if = "def_cache_max_blob_len_if" )] - #[structopt(long = "--rga-cache-max-blob-len", default_value = "2000000")] + #[structopt( + long = "--rga-cache-max-blob-len", + default_value = "2000000", + hidden_short_help = true + )] /// Max compressed size to cache /// /// Longest byte length (after compression) to store in cache. Longer adapter outputs will not be cached and recomputed every time. @@ -97,7 +106,8 @@ pub struct RgaArgs { long = "--rga-max-archive-recursion", default_value = "4", require_equals = true, - help = "Maximum nestedness of archives to recurse into" + help = "Maximum nestedness of archives to recurse into", + hidden_short_help = true )] pub max_archive_recursion: i32, diff --git a/src/bin/rga.rs b/src/bin/rga.rs index 64c7923..61a51ba 100644 --- a/src/bin/rga.rs +++ b/src/bin/rga.rs @@ -4,6 +4,7 @@ use rga::adapters::*; use rga::args::*; use rga::matching::*; use ripgrep_all as rga; +use structopt::StructOpt; use std::process::Command; @@ -41,6 +42,14 @@ fn main() -> Fallible<()> { } return Ok(()); } + + if passthrough_args.len() == 0 { + // rg would show help. Show own help instead. + RgaArgs::clap().print_help()?; + println!(""); + return Ok(()); + } + let adapters = get_adapters_filtered(&args.adapters)?; let pre_glob = if !args.accurate {