.. [no ci]

This commit is contained in:
sxyazi 2023-10-22 15:48:24 +08:00
parent bac1ee27fc
commit 96660cbab4
No known key found for this signature in database
2 changed files with 7 additions and 2 deletions

View file

@ -35,6 +35,8 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Build - name: Build
env:
YAZI_GEN_COMPLETIONS: true
run: cargo build --release --locked --target ${{ matrix.target }} run: cargo build --release --locked --target ${{ matrix.target }}
- name: Pack artifacts [Linux & macOS] - name: Pack artifacts [Linux & macOS]

View file

@ -1,12 +1,16 @@
#[path = "src/boot/cli.rs"] #[path = "src/boot/cli.rs"]
mod cli; mod cli;
use std::{fs, io}; use std::{env, fs, io};
use clap::CommandFactory; use clap::CommandFactory;
use clap_complete::{generate_to, Shell}; use clap_complete::{generate_to, Shell};
fn main() -> io::Result<()> { fn main() -> io::Result<()> {
if env::var_os("YAZI_GEN_COMPLETIONS").is_none() {
return Ok(());
}
let cmd = &mut cli::Args::command(); let cmd = &mut cli::Args::command();
let bin = "yazi"; let bin = "yazi";
let out = "completions"; let out = "completions";
@ -19,6 +23,5 @@ fn main() -> io::Result<()> {
generate_to(Shell::PowerShell, cmd, bin, out)?; generate_to(Shell::PowerShell, cmd, bin, out)?;
generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?; generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?;
generate_to(clap_complete_fig::Fig, cmd, bin, out)?; generate_to(clap_complete_fig::Fig, cmd, bin, out)?;
Ok(()) Ok(())
} }