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

Write generated completion script to stdout if directory is not provided as an argument #489

Closed
mcarifio opened this issue Jan 10, 2024 · 3 comments · Fixed by #495
Closed

Comments

@mcarifio
Copy link

A detailed description of the feature you would like to see added.

First, ty for pueue. Nushell is less usable without it.

pueue completions bash /tmp will generate a bash completion script /tmp/pueue.bash (for example). If no directory is provided, no completion script is generated. It would be useful if pueue completions bash output the completion script to stdout. Then in bash one could write: source <(pueue completions bash) without persisting intermediate files. This is particularly useful when installing new versions of pueue. It will keep the exe and completions in sync always.

I understand pueue is feature complete and the completion script won't change very often. Until it does and older copies are getting sourced and users (like me) get confused.

Explain your usecase of the requested feature

See above. I do note that /usr/share/bash-completion/completions/pueue is created and since it's installed with pueue that might solve the coordination concern.

Alternatives

I wrote a bash script to generate the completion script and source it when I log in:

pueue.complete() {
    local _tmp=$(mktemp --directory /tmp/${USER}-pueue-completions-XXXXX)
    local _shell=bash
    pueue completions ${_shell} ${_tmp}
    source ${_tmp}/pueue.${_shell}    && rm -rf ${_tmp}
}; pueue.complete

This works. It's a little janky.

Additional context

This is a "nice to have" for bash and zsh users. I don't know how other shells handle sourcing code from another process.

@Nukesor
Copy link
Owner

Nukesor commented Jan 10, 2024

I think that's a reasonable QoL adjustment :)

Usually, completion files should be deployed by the distribution's package manager, but pueue sadly hasn't been packaged for some of the bigger distros yet (fedora, debian)

@mcarifio
Copy link
Author

fc39 packages 3.0 I think, which has issues generating a sourceable completion script. I installed 3.2 manually and my janky script above will serve for now. Good devs don't let users drive jank (that's reachin', Seinfeld I ain't). Ty.

@Nukesor
Copy link
Owner

Nukesor commented Jan 17, 2024

Also good packagers should be up-to-date with upstream :)

This project adheres to semver and there's no reason for stuff not being up-to-date on fedora's side until a v4 is released (unless I don't know some specifics about Fedora's packaging guidelines, which might very much be the case)

As I already said above, this is still a nice QoL improvement and It should be fairly easy to implement.

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 a pull request may close this issue.

2 participants