From c3ba834bfe176ec015fb2fc6c0d81b1b0be9024f Mon Sep 17 00:00:00 2001 From: Knight Date: Sun, 5 Jun 2016 17:45:24 +0800 Subject: [PATCH 1/2] zsh: add path completion to manifest-path options --- src/etc/_cargo | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/etc/_cargo b/src/etc/_cargo index 4e03ba77ff2..c2d9770d771 100644 --- a/src/etc/_cargo +++ b/src/etc/_cargo @@ -40,7 +40,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]' \ @@ -53,7 +53,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]' \ @@ -67,7 +67,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]' \ @@ -82,7 +82,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)' \ @@ -91,7 +91,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)' \ @@ -148,7 +148,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) @@ -188,7 +188,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]' \ @@ -199,7 +199,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)' \ @@ -209,7 +209,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]' \ @@ -220,7 +220,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)' \ ;; @@ -231,7 +231,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]' \ @@ -291,7 +291,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]' \ @@ -319,7 +319,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]' \ @@ -330,7 +330,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)' \ From c7e2986151ac56847a947d281c03f4c1cd720676 Mon Sep 17 00:00:00 2001 From: Knight Date: Sun, 5 Jun 2016 18:08:20 +0800 Subject: [PATCH 2/2] Add zsh autocompletion to subcommand metadata --- src/etc/_cargo | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/etc/_cargo b/src/etc/_cargo index c2d9770d771..529aa89f745 100644 --- a/src/etc/_cargo +++ b/src/etc/_cargo @@ -16,7 +16,6 @@ _arguments \ case $state in args) - #TODO: add path completion to manifest-path options case $words[1] in bench) _arguments \ @@ -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]' \ @@ -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'