Skip to content

Commit e7ca9be

Browse files
committed
Auto merge of #14493 - shannmu:dynamic_switch, r=epage
feat: Add native comlpetion with CompleteEnv under the nightly ### What does this PR try to resolve? Related issue #6645 Tracking issue #14520 This PR is the first step to move cargo shell completions to native completions by using `clap_complete` crate. It makes users could complete cargo subcommand and flags. By using `clap_complete` crate, we could extend the supported shells to Bash, Zsh, Elvish, Fish, and PowerShell. However, at the current stage, the support for PowerShell in `clap_complete` is not fully developed. See clap-rs/clap#3166 to get more context about what features `clap_complete` has supported. ### How to test and review this PR? 1. Build a test environment, including the necessary short completion scripts, and the `complete` function to start an interactive shell with the help of a pty device and obtain completion results. 2. Simply test the completion results of subcommands in bash, zsh, fish, elvish.
2 parents bd5f32b + 7b0b977 commit e7ca9be

File tree

7 files changed

+652
-223
lines changed

7 files changed

+652
-223
lines changed

.github/workflows/main.yml

+8
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ jobs:
173173
- run: rustup target add ${{ matrix.other }}
174174
- run: rustup component add rustc-dev llvm-tools-preview rust-docs
175175
if: startsWith(matrix.rust, 'nightly')
176+
# Install fish, zsh, and elvish only on Ubuntu systems
177+
- name: Install fish, zsh, and elvish on Ubuntu
178+
run: sudo apt update -y && sudo apt install fish zsh elvish -y
179+
if: matrix.os == 'ubuntu-latest'
180+
- name: Install fish, elvish on macOS
181+
run: brew install fish elvish
182+
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
176183
- run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
177184
if: matrix.os == 'ubuntu-latest'
178185
- run: rustup component add rustfmt || echo "rustfmt not available"
@@ -227,6 +234,7 @@ jobs:
227234
- run: rustup update --no-self-update stable && rustup default stable
228235
- run: rustup target add i686-unknown-linux-gnu
229236
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
237+
- run: sudo apt update -y && sudo apt install fish zsh elvish -y
230238
- run: rustup component add rustfmt || echo "rustfmt not available"
231239
- run: cargo test -p cargo
232240
env:

0 commit comments

Comments
 (0)