summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-09-07 13:28:57 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-09-07 13:29:05 -0400
commitc12acd7396ce550483d3d840853b9cbde9db032c (patch)
treee738934d64a22c311815799ca8fb1b92f7ead4a5
parent71fb43e51e3983bab83fe812d2b5e511ee66002d (diff)
deb: add completions
This commit adds Bash, zsh and fish completions to the Debian binary package. Fixes #1032
-rw-r--r--Cargo.toml8
-rwxr-xr-xci/build_deb.sh22
2 files changed, 23 insertions, 7 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 49c3ad89..76888d9b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -91,9 +91,13 @@ assets = [
["FAQ.md", "usr/share/doc/ripgrep/FAQ", "644"],
# The man page is automatically generated by ripgrep's build process, so
# this file isn't actually commited. Instead, to create a dpkg, either
- # create a deployment directory and copy the man page to it, or use the
+ # create a deployment/deb directory and copy the man page to it, or use the
# 'ci/build_deb.sh' script.
- ["deployment/rg.1", "usr/share/man/man1/rg.1", "644"],
+ ["deployment/deb/rg.1", "usr/share/man/man1/rg.1", "644"],
+ # Similarly for shell completions.
+ ["deployment/deb/rg.bash", "usr/share/bash-completion/completions/rg", "644"],
+ ["deployment/deb/rg.fish", "usr/share/fish/completions/rg.fish", "644"],
+ ["deployment/deb/_rg", "usr/share/zsh/vendor-completions/", "644"],
]
extended-description = """\
ripgrep (rg) recursively searches your current directory for a regex pattern.
diff --git a/ci/build_deb.sh b/ci/build_deb.sh
index eb516191..4812b47e 100755
--- a/ci/build_deb.sh
+++ b/ci/build_deb.sh
@@ -18,14 +18,26 @@ fi
# 'cargo deb' does not seem to provide a way to specify an asset that is
# created at build time, such as ripgrep's man page. To work around this,
-# we force a debug build, copy out the man page produced from that build, put
-# it into a predictable location and then build the deb, which knows where to
-# look.
+# we force a debug build, copy out the man page (and shell completions)
+# produced from that build, put it into a predictable location and then build
+# the deb, which knows where to look.
-mkdir -p deployment
+DEPLOY_DIR=deployment/deb
+mkdir -p "$DEPLOY_DIR"
cargo build
+
+# Find and copy man page.
manpage="$(find ./target/debug -name rg.1 -print0 | xargs -0 ls -t | head -n1)"
-cp "$manpage" deployment/
+cp "$manpage" "$DEPLOY_DIR/"
+
+# Do the same for shell completions.
+compbash="$(find ./target/debug -name rg.bash -print0 | xargs -0 ls -t | head -n1)"
+cp "$compbash" "$DEPLOY_DIR/"
+compfish="$(find ./target/debug -name rg.fish -print0 | xargs -0 ls -t | head -n1)"
+cp "$compfish" "$DEPLOY_DIR/"
+compzsh="complete/_rg"
+cp "$compzsh" "$DEPLOY_DIR/"
+
# Since we're distributing the dpkg, we don't know whether the user will have
# PCRE2 installed, so just do a static build.
PCRE2_SYS_STATIC=1 cargo deb