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

CI/CD: PowerShell completion script is built but not released #952

Closed
YDX-2147483647 opened this issue Nov 12, 2023 · 0 comments · Fixed by #953
Closed

CI/CD: PowerShell completion script is built but not released #952

YDX-2147483647 opened this issue Nov 12, 2023 · 0 comments · Fixed by #953

Comments

@YDX-2147483647
Copy link
Contributor

YDX-2147483647 commented Nov 12, 2023

In autocomplete/ of lsd-v1.0.0-x86_64-pc-windows-*.zip from https://github.com/lsd-rs/lsd/releases/tag/v1.0.0, there are only lsd.bash-completion, lsd.fish, and _lsd, but not _lsd.ps1.

We are building _lsd.ps1, but the workflow never releases it!

lsd/build.rs

Lines 32 to 36 in 6f8e095

generate_to(Bash, &mut app, bin_name, &outdir).expect("Failed to generate Bash completions");
generate_to(Fish, &mut app, bin_name, &outdir).expect("Failed to generate Fish completions");
generate_to(Zsh, &mut app, bin_name, &outdir).expect("Failed to generate Zsh completions");
generate_to(PowerShell, &mut app, bin_name, &outdir)
.expect("Failed to generate PowerShell completions");

# autocomplete
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}-'*/'out/${{ env.PROJECT_NAME }}.bash' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete/${{ env.PROJECT_NAME }}.bash-completion'
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}-'*/'out/${{ env.PROJECT_NAME }}.fish' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete/'
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}-'*/'out/_${{ env.PROJECT_NAME }}' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete/'

I notice that _lsd.ps1 is built but not released from the beginning (commit 98bc907: Add a complete CD)…
Is it on purpose? If not, I can make a PR. I've submitted #953. If that's intentional, please close it.

Possible fix

Add the following line to CICD.yml.

         cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}-'*/'out/_${{ env.PROJECT_NAME }}.ps1' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete/' 

The filename _lsd.ps1 is hard coded in clap, and I've verified it locally.

impl Generator for PowerShell {
    fn file_name(&self, name: &str) -> String {
        format!("_{name}.ps1")
    }
}
$ lsd ./target/debug/build/lsd-4e8da84150b024f4/out
_lsd  _lsd.ps1  lsd.bash  lsd.fish

(Besides, ripgrep releases _lsd.ps1 in a similar way)

https://github.com/BurntSushi/ripgrep/blob/7099e174acbcbd940f57e4ab4913fee4040c826e/.github/workflows/release.yml#L150-L151

        cp "$outdir"/{rg.bash,rg.fish,_rg.ps1} "$staging/complete/"
        cp complete/_rg "$staging/complete/"
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.

1 participant