0bcecf2f636b8070639b6db44b8541015f574365
- Author
- Harry <cra0zy@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/dotnet/README.md b/plugins/dotnet/README.md
2index a663fc88da03e7c42992093da58077bb9a5edeba..7554b4e3c4b063ac80070ff3e8461283aae69dfd 100644
3--- a/plugins/dotnet/README.md
4+++ b/plugins/dotnet/README.md
5@@ -20,4 +20,4 @@ plugins=(... dotnet)
6 | ds | dotnet sln | Modify Visual Studio solution files. |
7 | da | dotnet add | Add a package or reference to a .NET project. |
8 | dp | dotnet pack | Create a NuGet package. |
9-| dng | dotnet nuget | Provides additional NuGet commands. |
10+| dng | dotnet nuget | Provides additional NuGet commands. |
11diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh
12index ed6c68e5d17bc5e0264bf5cba884693d9c575333..6bd4b7af8aa1162256e95c82ea9bf9b3c91fe929 100644
13--- a/plugins/dotnet/dotnet.plugin.zsh
14+++ b/plugins/dotnet/dotnet.plugin.zsh
15@@ -1,114 +1,27 @@
16-# --------------------------------------------------------------------- #
17-# Aliases and Completions for .NET Core (https://dotnet.microsoft.com/) #
18-# Author: Shaun Tabone (https://github.com/xontab) #
19-# --------------------------------------------------------------------- #
20+# This scripts is copied from (MIT License):
21+# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
22
23-# Helper function to cache and load completions
24-local cache_base_path="${ZSH_CACHE_DIR}/dotnet_"
25-_dotnet_cache_completion() {
26- local cache="${cache_base_path}$(echo $1)_completion"
27- if [[ ! -f $cache ]]; then
28- $2 $cache
29- fi
30+_dotnet_zsh_complete()
31+{
32+ local completions=("$(dotnet complete "$words")")
33
34- [[ -f $cache ]] && cat $cache
35-}
36+ # If the completion list is empty, just continue with filename selection
37+ if [ -z "$completions" ]
38+ then
39+ _arguments '*::arguments: _normal'
40+ return
41+ fi
42
43-_dotnet_cache_completion_cleanup() {
44- local cache="${cache_base_path}$(echo $1)_completion"
45- rm -f $cache
46+ # This is not a variable assigment, don't remove spaces!
47+ _values = "${(ps:\n:)completions}"
48 }
49
50-# --------------------------------------------------------------------- #
51-# dotnet new #
52-# ALIAS: dn #
53-# --------------------------------------------------------------------- #
54-_dotnet_new_completion() {
55- if [ $commands[dotnet] ]; then
56- dotnet new -l | tail -n +21 | sed 's/ \+/:/g' | cut -d : -f 2 >$1
57- fi
58-}
59+compdef _dotnet_zsh_complete dotnet
60
61-_dotnet_new_completion_cached() {
62- _dotnet_cache_completion 'new' _dotnet_new_completion
63-}
64-
65-_dotnet_cache_completion_cleanup 'new'
66+# Aliases bellow are here for backwards compatibility
67+# added by Shaun Tabone (https://github.com/xontab)
68
69 alias dn='dotnet new'
70-
71-# --------------------------------------------------------------------- #
72-# dotnet #
73-# --------------------------------------------------------------------- #
74-_dotnet() {
75- if [ $CURRENT -eq 2 ]; then
76- _arguments \
77- '--diagnostics[Enable diagnostic output.]' \
78- '--help[Show command line help.]' \
79- '--info[Display .NET Core information.]' \
80- '--list-runtimes[Display the installed runtimes.]' \
81- '--list-sdks[Display the installed SDKs.]' \
82- '--version[Display .NET Core SDK version in use.]'
83-
84- _values \
85- 'add[Add a package or reference to a .NET project.]' \
86- 'build[Build a .NET project.]' \
87- 'build-server[Interact with servers started by a build.]' \
88- 'clean[Clean build outputs of a .NET project.]' \
89- 'help[Show command line help.]' \
90- 'list[List project references of a .NET project.]' \
91- 'msbuild[Run Microsoft Build Engine (MSBuild) commands.]' \
92- 'new[Create a new .NET project or file.]' \
93- 'nuget[Provides additional NuGet commands.]' \
94- 'pack[Create a NuGet package.]' \
95- 'publish[Publish a .NET project for deployment.]' \
96- 'remove[Remove a package or reference from a .NET project.]' \
97- 'restore[Restore dependencies specified in a .NET project.]' \
98- 'run[Build and run a .NET project output.]' \
99- 'sln[Modify Visual Studio solution files.]' \
100- 'store[Store the specified assemblies in the runtime package store.]' \
101- 'test[Run unit tests using the test runner specified in a .NET project.]' \
102- 'tool[Install or manage tools that extend the .NET experience.]' \
103- 'vstest[Run Microsoft Test Engine (VSTest) commands.]' \
104- 'dev-certs[Create and manage development certificates.]' \
105- 'fsi[Start F# Interactive / execute F# scripts.]' \
106- 'sql-cache[SQL Server cache command-line tools.]' \
107- 'user-secrets[Manage development user secrets.]' \
108- 'watch[Start a file watcher that runs a command when files change.]'
109- return
110- fi
111-
112- if [ $CURRENT -eq 3 ]; then
113- case ${words[2]} in
114- "new")