Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve autocompletion #2772

Merged
merged 2 commits into from
Jun 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions src/etc/_cargo
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ _arguments \

case $state in
args)
#TODO: add path completion to manifest-path options
case $words[1] in
bench)
_arguments \
Expand All @@ -40,7 +39,7 @@ case $state in
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of jobs to run in parallel]' \
"${command_scope_spec[@]}" \
'--manifest-path=[path to manifest]: :files -/' \
'--manifest-path=[path to manifest]: :_files -/' \
'--no-default-features[do not build the default features]' \
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
'--release=[build in release mode]' \
Expand All @@ -53,7 +52,7 @@ case $state in
clean)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[whether or not to clean release artifacts]' \
Expand All @@ -67,7 +66,7 @@ case $state in
'--features=[space separated feature list]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of jobs to run in parallel]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--no-deps[do not build docs for dependencies]' \
'--no-default-features[do not build the default features]' \
'--open[open docs in browser after the build]' \
Expand All @@ -82,7 +81,7 @@ case $state in
fetch)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
Expand All @@ -91,7 +90,7 @@ case $state in
generate-lockfile)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
Expand Down Expand Up @@ -148,7 +147,7 @@ case $state in
locate-project)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
;;

login)
Expand All @@ -160,6 +159,19 @@ case $state in
'--color=:colorization option:(auto always never)' \
;;

metadata)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
"--no-deps[output information only about the root package and don't fetch dependencies]" \
'--no-default-features[do not include the default feature]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--features=[space separated feature list]' \
'--format-version=[format version(default: 1)]' \
'--color=:colorization option:(auto always never)' \
;;

new)
_arguments \
'--bin[use binary template]' \
Expand Down Expand Up @@ -188,7 +200,7 @@ case $state in
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-l, --list)'{-l,--list}'[print files included in a package without making one]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
'--no-verify[do not build to verify contents]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
Expand All @@ -199,7 +211,7 @@ case $state in
pkgid)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
Expand All @@ -209,7 +221,7 @@ case $state in
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--host=[Host to set the token for]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--no-verify[Do not verify tarball until before publish]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--token[token to use when uploading]' \
Expand All @@ -220,7 +232,7 @@ case $state in
read-manifest)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
;;
Expand All @@ -231,7 +243,7 @@ case $state in
'--features=[space separated feature list]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of jobs to run in parallel]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--bin=[name of the bin target]' \
'--no-default-features[do not build the default features]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
Expand Down Expand Up @@ -291,7 +303,7 @@ case $state in
'--features=[space separated feature list]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of jobs to run in parallel]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--test=[test name]: :_test_names' \
'--no-default-features[do not build the default features]' \
'--no-fail-fast[run all tests regardless of failure]' \
Expand Down Expand Up @@ -319,7 +331,7 @@ case $state in
_arguments \
'--aggressive=[force dependency update]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \
'--precise=[update single dependency to PRECISE]: :' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
Expand All @@ -330,7 +342,7 @@ case $state in
verify-project)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
Expand Down Expand Up @@ -373,6 +385,7 @@ local -a commands;commands=(
'install:install a Rust binary'
'locate-project:print "Cargo.toml" location'
'login:login to remote server'
'metadata:the metadata for a project in json'
'new:create a new project'
'owner:manage the owners of a crate on the registry'
'package:assemble local package into a distributable tarball'
Expand Down