-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: shell completions & auto releasing (#282)
- Loading branch information
Showing
12 changed files
with
160 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
publish: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- os: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
- os: macos-latest | ||
target: aarch64-apple-darwin | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache Dependencies | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build | ||
run: cargo build --release --locked --target ${{ matrix.target }} | ||
|
||
- name: Pack Artifacts [Linux & macOS] | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
env: | ||
RELEASE_NAME: yazi-${{ matrix.target }} | ||
run: | | ||
mkdir $RELEASE_NAME | ||
cp target/${{ matrix.target }}/release/yazi $RELEASE_NAME | ||
cp -r config/completions $RELEASE_NAME | ||
cp README.md LICENSE $RELEASE_NAME | ||
zip -r $RELEASE_NAME.zip $RELEASE_NAME | ||
- name: Pack Artifacts [Windows] | ||
if: matrix.os == 'windows-latest' | ||
env: | ||
RELEASE_NAME: yazi-${{ matrix.target }} | ||
run: | | ||
New-Item -ItemType Directory -Path ${env:RELEASE_NAME} | ||
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:RELEASE_NAME} | ||
Copy-Item -Path "config\completions" -Destination ${env:RELEASE_NAME} -Recurse | ||
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:RELEASE_NAME} | ||
Compress-Archive -Path ${env:RELEASE_NAME} -DestinationPath "${env:RELEASE_NAME}.zip" | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: yazi-${{ matrix.target }}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
target/ | ||
config/completions | ||
|
||
.DS_Store | ||
|
||
result | ||
result-* | ||
.devenv* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#[path = "src/boot/cli.rs"] | ||
mod cli; | ||
|
||
use std::{fs, io}; | ||
|
||
use clap::CommandFactory; | ||
use clap_complete::{generate_to, Shell}; | ||
|
||
fn main() -> io::Result<()> { | ||
let cmd = &mut cli::Args::command(); | ||
let bin = "yazi"; | ||
let out = "completions"; | ||
|
||
fs::create_dir_all(out)?; | ||
generate_to(Shell::Bash, cmd, bin, out)?; | ||
generate_to(Shell::Fish, cmd, bin, out)?; | ||
generate_to(Shell::Zsh, cmd, bin, out)?; | ||
generate_to(Shell::Elvish, cmd, bin, out)?; | ||
generate_to(Shell::PowerShell, cmd, bin, out)?; | ||
generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?; | ||
generate_to(clap_complete_fig::Fig, cmd, bin, out)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::path::PathBuf; | ||
|
||
use clap::{command, Parser}; | ||
|
||
#[derive(Debug, Parser)] | ||
#[command(name = "yazi", version)] | ||
pub(super) struct Args { | ||
/// Set the current working directory | ||
#[arg(index = 1)] | ||
pub cwd: Option<PathBuf>, | ||
|
||
/// Write the cwd on exit to this file | ||
#[arg(long)] | ||
pub cwd_file: Option<PathBuf>, | ||
/// Write the selected files on open emitted by the chooser mode | ||
#[arg(long)] | ||
pub chooser_file: Option<PathBuf>, | ||
|
||
/// Clear the cache directory | ||
#[arg(long, action)] | ||
pub clear_cache: bool, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod boot; | ||
mod cli; | ||
|
||
pub use boot::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","linemode","setpgid","perror"],"version":"0.2","flagWords":[],"language":"en"} | ||
{"version":"0.2","language":"en","words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch"],"flagWords":[]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters