target name completion
This commit is contained in:
parent
cae540f899
commit
925667f355
@ -28,7 +28,7 @@ case $state in
|
|||||||
'--no-default-features[do not build the default features]' \
|
'--no-default-features[do not build the default features]' \
|
||||||
'--no-run[compile but do not run]' \
|
'--no-run[compile but do not run]' \
|
||||||
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
|
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
|
||||||
'--target=[target triple]' \
|
'--target=[target triple]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--color=:colorization option:(auto always never)' \
|
||||||
@ -45,7 +45,7 @@ case $state in
|
|||||||
'--no-default-features[do not build the default features]' \
|
'--no-default-features[do not build the default features]' \
|
||||||
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
|
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
|
||||||
'--release=[build in release mode]' \
|
'--release=[build in release mode]' \
|
||||||
'--target=[target triple]' \
|
'--target=[target triple]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--color=:colorization option:(auto always never)' \
|
||||||
@ -58,7 +58,7 @@ case $state in
|
|||||||
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
|
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--release[whether or not to clean release artifacts]' \
|
'--release[whether or not to clean release artifacts]' \
|
||||||
'--target=[target triple(default:all)]' \
|
'--target=[target triple(default:all)]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--color=:colorization option:(auto always never)' \
|
||||||
;;
|
;;
|
||||||
@ -76,7 +76,7 @@ case $state in
|
|||||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--release[build artifacts in release mode, with optimizations]' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'--target=[build for the target triple]' \
|
'--target=[build for the target triple]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--color=:colorization option:(auto always never)' \
|
||||||
;;
|
;;
|
||||||
@ -273,7 +273,7 @@ case $state in
|
|||||||
'--profile=[profile to build the selected target for]' \
|
'--profile=[profile to build the selected target for]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--release[build artifacts in release mode, with optimizations]' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'--target=[target triple which compiles will be for]' \
|
'--target=[target triple which compiles will be for]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
"${command_scope_spec[@]}" \
|
"${command_scope_spec[@]}" \
|
||||||
;;
|
;;
|
||||||
@ -291,7 +291,7 @@ case $state in
|
|||||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--release[build artifacts in release mode, with optimizations]' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'--target=[build for the target triple]' \
|
'--target=[build for the target triple]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
"${command_scope_spec[@]}" \
|
"${command_scope_spec[@]}" \
|
||||||
;;
|
;;
|
||||||
@ -320,7 +320,7 @@ case $state in
|
|||||||
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
|
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
|
||||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||||
'--release[build artifacts in release mode, with optimizations]' \
|
'--release[build artifacts in release mode, with optimizations]' \
|
||||||
'--target=[target triple]' \
|
'--target=[target triple]: :_get_targets' \
|
||||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||||
'--color=:colorization option:(auto always never)' \
|
'--color=:colorization option:(auto always never)' \
|
||||||
'1: :_test_names' \
|
'1: :_test_names' \
|
||||||
@ -481,6 +481,37 @@ _benchmark_names()
|
|||||||
_get_names_from_array "bench"
|
_get_names_from_array "bench"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Gets the target names from config files
|
||||||
|
_get_targets()
|
||||||
|
{
|
||||||
|
local CURRENT_PATH
|
||||||
|
if [[ $(uname -o) = "Cygwin" && -f "$PWD"/Cargo.toml ]]; then
|
||||||
|
CURRENT_PATH=$PWD
|
||||||
|
else
|
||||||
|
CURRENT_PATH=$(_locate_manifest)
|
||||||
|
fi
|
||||||
|
if [[ -z "$CURRENT_PATH" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local -a TARGETS
|
||||||
|
local -a FIND_PATHS=( "/" )
|
||||||
|
local -a FLINES
|
||||||
|
local FIND_PATH FLINE
|
||||||
|
while [[ "$CURRENT_PATH" != "/" ]]; do
|
||||||
|
FIND_PATHS+=( "$CURRENT_PATH" )
|
||||||
|
CURRENT_PATH=$(dirname $CURRENT_PATH)
|
||||||
|
done
|
||||||
|
for FIND_PATH in ${FIND_PATHS[@]}; do
|
||||||
|
if [[ -f "$FIND_PATH"/.cargo/config ]]; then
|
||||||
|
FLINES=( `grep "$FIND_PATH"/.cargo/config -e "^\[target\."` )
|
||||||
|
for FLINE in ${FLINES[@]}; do
|
||||||
|
TARGETS+=(`sed 's/^\[target\.\(.*\)\]$/\1/' <<< $FLINE`)
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
_describe 'target' TARGETS
|
||||||
|
}
|
||||||
|
|
||||||
# These flags are mutally exclusive specifiers for the scope of a command; as
|
# These flags are mutally exclusive specifiers for the scope of a command; as
|
||||||
# they are used in multiple places without change, they are expanded into the
|
# they are used in multiple places without change, they are expanded into the
|
||||||
# appropriate command's `_arguments` where appropriate.
|
# appropriate command's `_arguments` where appropriate.
|
||||||
|
Loading…
Reference in New Issue
Block a user