Skip to content

Commit

Permalink
Add Zsh completion for target triples
Browse files Browse the repository at this point in the history
Target triples are used for specifying targets for e.g. `cargo build
--target thumbv7em-none-eabihf` where `thumbv7em-none-eabihf` is the
target triplet.
For more information on target triples, see
<https://doc.rust-lang.org/cargo/appendix/glossary.html#target>.
  • Loading branch information
nop committed Sep 28, 2020
1 parent 76c0161 commit 7a9810f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/etc/_cargo
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ _cargo() {
)

msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
triple='--target=[specify target triple]:target triple'
triple='--target=[specify target triple]:target triple:_cargo_target_triple'
target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
manifest='--manifest-path=[specify path to manifest]:path:_directories'
registry='--registry=[specify registry to use]:registry'
Expand Down Expand Up @@ -359,6 +359,11 @@ _cargo_cmds() {
_describe -t commands 'command' commands
}

_cargo_target_triple() {
local -a targets
targets=( ${(f)"$(rustc --print target-list)"} )
_describe 'target triple' targets
}

#FIXME: Disabled until fixed
#gets package names from the manifest file
Expand Down

0 comments on commit 7a9810f

Please sign in to comment.