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

Add bash completions #153

Merged
merged 5 commits into from Oct 22, 2019
Merged

Add bash completions #153

merged 5 commits into from Oct 22, 2019

Conversation

MarkusG
Copy link
Contributor

@MarkusG MarkusG commented Oct 8, 2019

Create the /completions directory and add a completion script for bash

This addresses #127, for bash at least

Requesting advice on how to fully implement this into playerctl - whether it should be hard-coded into the binary or read from a file.

Create the /completions directory and add a completion script for bash
@acrisci
Copy link
Member

acrisci commented Oct 9, 2019

I want to keep it in the repo as a file so it's easier to edit and I might want to distribute the file as well for the use case where people want to source the file instead of run the binary.

To do this, there are two options. You could either template the completions in with meson or follow these instructions to convert the files into something that can be linked in.

Complete -i and -p with currently available players; complete the open
command with filenames
Create meson.build file in completions/ to install the completion script
to /etc/bash_completion.d; add completions subdir in root meson.build;
rename completions.bash to playerctl.bash
@MarkusG
Copy link
Contributor Author

MarkusG commented Oct 10, 2019

Applied requested changes to the completion script and edited build files to install to /etc/bash_completion.d/playerctl.bash

completions/meson.build Outdated Show resolved Hide resolved
@acrisci
Copy link
Member

acrisci commented Oct 10, 2019

Hey @knowledgejunkie we're getting bash completions. Do you know of any guidelines on how to package them?

@knowledgejunkie
Copy link
Contributor

I'm not aware of specific guidelines on how to package them in source. Many projects that include bash/zsh completions (in e.g. contrib/completions/*) leave it up to the end user to manually install them (per user or system-wide). Other projects might make it part of the make install process to make them available to all users.

Distros usually have special tooling in the packaging build system to ensure completions get installed into the correct location (e.g. on Debian we have the dh_bash-completion tool which installs to /usr/share/bash-completion/completions/) to make them available to all users on the system.

@acrisci
Copy link
Member

acrisci commented Oct 21, 2019

Thanks. From what I can see based on that discussion, bash completions are usually supposed to go in a separate package. So we won't install them by default and leave it up to the packagers to decide how to handle it.

This reverts commit 5fe2e2e.

Shell completions should not be included in the build process. Instead,
package maintainers can decide how they want to distribute shell
completion scripts.
Rename bash completion script from 'completions.bash' to
'playerctl.bash' to make the file more easily identifiable oustide the
context of this repository
@MarkusG
Copy link
Contributor Author

MarkusG commented Oct 21, 2019

Sounds good to me. Took the completions out of the package.

@acrisci
Copy link
Member

acrisci commented Oct 22, 2019

👍 👍

@acrisci acrisci merged commit d4e13ca into altdesktop:master Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants