Skip to content

Commit

Permalink
Merge pull request #452 from str4d/rage-fix-completion-paths
Browse files Browse the repository at this point in the history
Fix Debian installation paths for completion files
  • Loading branch information
str4d authored Jan 20, 2024
2 parents b9e1565 + 857f2ec commit cbf2710
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 6 deletions.
4 changes: 4 additions & 0 deletions rage/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ to 1.0.0 are beta releases.
## [Unreleased]
### Added
- `rage-keygen -y IDENTITY_FILE` to convert identity files to recipients.
- Elvish completions to the Debian package. These are not automatically
discovered; Elvish users will need to manually import them.

### Changed
- MSRV is now 1.65.0.
Expand All @@ -27,6 +29,8 @@ to 1.0.0 are beta releases.
- `rage-keygen` now prints fatal errors directly instead of them being hidden
behind the `RUST_LOG=error` environment variable. It also now sets its return
code appropriately instead of always returning 0.
- The Debian package now uses the correct installation paths for fish and Zsh
completions.

## [0.9.2] - 2023-06-12
### Changed
Expand Down
62 changes: 56 additions & 6 deletions rage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,65 @@ assets = [
["target/release/rage", "usr/bin/", "755"],
["target/release/rage-keygen", "usr/bin/", "755"],
["target/release/rage-mount", "usr/bin/", "755"],

# From the bash-completion FAQ (https://github.com/scop/bash-completion/blob/master/README.md#faq):
# > Q. I author/maintain package X and would like to maintain my own completion code
# > for this package. Where should I put it to be sure that interactive bash shells
# > will find it and source it?
# > A. Install it in one of the directories pointed to by bash-completion's `pkgconfig`
# > file variables. [..] The recommended directory is `completionsdir`, which you
# > can get with `pkg-config --variable=completionsdir bash-completion`.
#
# On Ubuntu 22.04 this resolves to `/usr/share/bash-completion/completions`.
["target/release/completions/rage.bash", "usr/share/bash-completion/completions/rage", "644"],
["target/release/completions/rage-keygen.bash", "usr/share/bash-completion/completions/rage-keygen", "644"],
["target/release/completions/rage-mount.bash", "usr/share/bash-completion/completions/rage-mount", "644"],
["target/release/completions/rage.fish", "usr/share/fish/completions/", "644"],
["target/release/completions/rage-keygen.fish", "usr/share/fish/completions/", "644"],
["target/release/completions/rage-mount.fish", "usr/share/fish/completions/", "644"],
["target/release/completions/_rage", "usr/share/zsh/functions/Completion/Debian/", "644"],
["target/release/completions/_rage-keygen", "usr/share/zsh/functions/Completion/Debian/", "644"],
["target/release/completions/_rage-mount", "usr/share/zsh/functions/Completion/Debian/", "644"],

# From https://github.com/elves/elvish/issues/1564#issuecomment-1166333636:
# > Completion files can be installed like other modules into a global module search
# > directory ([..]). There is no automatic discovery of completion files though; the
# > user would have to import them manually with `use`.
#
# From https://elv.sh/ref/command.html#module-search-directories:
# > When importing modules, Elvish searches the following directories:
# > [..]
# > 3. If the XDG_DATA_DIRS environment variable is defined and non-empty, it is
# > treated as a colon-delimited list of paths (semicolon-delimited on Windows),
# > which are all searched.
# >
# > Otherwise, `/usr/local/share/elvish/lib` and `/usr/share/elvish/lib` are
# > searched on non-Windows OSes.
["target/release/completions/rage.elv", "usr/share/elvish/lib/", "644"],
["target/release/completions/rage-keygen.elv", "usr/share/elvish/lib/", "644"],
["target/release/completions/rage-mount.elv", "usr/share/elvish/lib/", "644"],

# From https://fishshell.com/docs/current/completions.html#where-to-put-completions:
# > By default, Fish searches the following for completions, using the first available
# > file that it finds:
# > [..]
# > - A directory for third-party software vendors to ship their own completions for
# > their software, usually `/usr/share/fish/vendor_completions.d`;
# > [..]
# > If you are developing another program and would like to ship completions with your
# > program, install them to the “vendor” completions directory. As this path may vary
# > from system to system, the `pkgconfig` framework should be used to discover this
# > path with the output of `pkg-config --variable completionsdir fish`.
["target/release/completions/rage.fish", "usr/share/fish/vendor_completions.d/", "644"],
["target/release/completions/rage-keygen.fish", "usr/share/fish/vendor_completions.d/", "644"],
["target/release/completions/rage-mount.fish", "usr/share/fish/vendor_completions.d/", "644"],

# The best reference I can find for the Zsh completions path is
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921236#17 from February 2019:
# > As a rule, completion functions (first line is "#compdef") should be
# > installed to /usr/share/zsh/vendor-completions and autoloadable
# > functions (first line is "#autoload") to /usr/share/zsh/vendor-functions;
# > both of these paths are Debian-specific.
["target/release/completions/_rage", "usr/share/zsh/vendor-completions/", "644"],
["target/release/completions/_rage-keygen", "usr/share/zsh/vendor-completions/", "644"],
["target/release/completions/_rage-mount", "usr/share/zsh/vendor-completions/", "644"],

# From the default `/etc/manpath.config` created by the `man-db` package:
# > MANPATH_MAP /usr/bin /usr/share/man
["target/release/manpages/rage.1.gz", "usr/share/man/man1/", "644"],
["target/release/manpages/rage-keygen.1.gz", "usr/share/man/man1/", "644"],
["target/release/manpages/rage-mount.1.gz", "usr/share/man/man1/", "644"],
Expand Down

0 comments on commit cbf2710

Please sign in to comment.