Skip to content

Commit 8d19f0f

Browse files
committed
(chocolatey#2641) Add deprecation for shims in help text
This commit updates the help text for relevant commands to mention that their shims will be removed in v2.0.0
1 parent 49c781f commit 8d19f0f

7 files changed

+57
-24
lines changed

nuget/chocolatey/tools/chocolateysetup.psm1

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ param(
314314

315315
$from = "$chocolateyPathOld\bin"
316316
$to = "$chocolateyPath\bin"
317+
# TODO: This exclusion list needs to be updated once shims are removed
317318
$exclude = @("choco.exe", "chocolatey.exe", "cinst.exe", "clist.exe", "cpack.exe", "cpush.exe", "cuninst.exe", "cup.exe", "cver.exe", "RefreshEnv.cmd")
318319
Get-ChildItem -Path $from -recurse -Exclude $exclude |
319320
% {

src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ public static void display_help_message(Container container = null)
9393
}
9494

9595
"chocolatey".Log().Info(@"This is a listing of all of the different things you can pass to choco.
96+
");
97+
98+
"chocolatey".Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE");
99+
"chocolatey".Log().Warn(@"
100+
The shims `chocolatey`, `cinst`, `clist`, `cpush`, `cuninst` and `cup` are deprecated.
101+
We recommend updating all scripts to use their full command equivalent as these will be
102+
removed in v2.0.0 of Chocolatey
96103
");
97104
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches");
98105

@@ -160,7 +167,7 @@ Following this guide will ensure your experience is not frustrating
160167
based on choco not receiving things you think you are passing to it.
161168
162169
* For consistency, always use `choco`, not `choco.exe`. Never use
163-
shortcut commands like `cinst` or `cup`.
170+
shortcut commands like `cinst` or `cup` (The shortcuts `cinst` and `cup` will be removed in v2.0.0).
164171
* Always have the command as the first argument to `choco`. e.g.
165172
`choco install`, where `install` is the command.
166173
* If there is a subcommand, ensure that is the second argument. e.g.

src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2017 - 2021 Chocolatey Software, Inc
1+
// Copyright © 2017 - 2021 Chocolatey Software, Inc
22
// Copyright © 2011 - 2017 RealDimensions Software, LLC
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -238,19 +238,25 @@ public virtual void help_message(ChocolateyConfiguration configuration)
238238
this.Log().Info(ChocolateyLoggers.Important, "Install Command");
239239
this.Log().Info(@"
240240
Installs a package or a list of packages (sometimes specified as a
241-
packages.config). Some may prefer to use `cinst` as a shortcut for
242-
`choco install`.
241+
packages.config).
243242
244243
NOTE: 100% compatible with older chocolatey client (0.9.8.32 and below)
245244
with options and switches. Add `-y` for previous behavior with no
246245
prompt. In most cases you can still pass options and switches with one
247246
dash (`-`). For more details, see the command reference (`choco -?`).
248247
");
249248

249+
"chocolatey".Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE");
250+
"chocolatey".Log().Warn(@"
251+
Starting in v2.0.0 the shortcut `cinst` will be removed and can not be used
252+
to install packages anymore. We recommend you make sure that you always
253+
use the full command going forward (`choco install`).
254+
");
255+
250256
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
251257
"chocolatey".Log().Info(@"
252258
choco install <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>]
253-
cinst <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>]
259+
cinst <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>] (DEPRECATED, will be removed in v2.0.0)
254260
255261
NOTE: `all` is a special package keyword that will allow you to install
256262
all packages from a custom feed. Will not work with Chocolatey default

src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2017 - 2021 Chocolatey Software, Inc
1+
// Copyright © 2017 - 2021 Chocolatey Software, Inc
22
// Copyright © 2011 - 2017 RealDimensions Software, LLC
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -166,6 +166,16 @@ and switches with one dash (`-`). For more details, see
166166
the command reference (`choco -?`).
167167
");
168168

169+
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
170+
// TODO: use command name in usage and examples, instead of hard
171+
// coding the names?
172+
"chocolatey".Log().Info(@"
173+
choco find <filter> [<options/switches>]
174+
choco list <filter> [<options/switches>]
175+
choco search <filter> [<options/switches>]
176+
clist <filter> [<options/switches>] (DEPRECATED, will be removed in v2.0.0)
177+
");
178+
169179
if (configuration.CommandName.is_equal_to("list"))
170180
{
171181
"chocolatey".Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE");
@@ -177,18 +187,12 @@ Starting in v2.0.0 the list command will be made local only and will only
177187
178188
To avoid breakage, change any calls made to remote sources to use `choco search`
179189
or `choco find` instead. These will continue to work as usual.
180-
");
181-
}
182190
183-
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
184-
// TODO: use command name in usage and examples, instead of hard
185-
// coding the names?
186-
"chocolatey".Log().Info(@"
187-
choco find <filter> [<options/switches>]
188-
choco list <filter> [<options/switches>]
189-
choco search <filter> [<options/switches>]
190-
clist <filter> [<options/switches>]
191+
Starting in v2.0.0 the shortcut `clist` will be removed and can not be used
192+
to list package anymore. We recommend you make sure that you always
193+
use the full command going forward (`choco list`).
191194
");
195+
}
192196

193197
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Examples");
194198
"chocolatey".Log().Info(@"

src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ public virtual void help_message(ChocolateyConfiguration configuration)
114114
this.Log().Info(ChocolateyLoggers.Important, "Push Command");
115115
this.Log().Info(@"
116116
Chocolatey will attempt to push a compiled nupkg to a package feed.
117-
Some may prefer to use `cpush` as a shortcut for `choco push`.
118117
119118
NOTE: 100% compatible with older chocolatey client (0.9.8.32 and below)
120119
with options and switches. In most cases you can still pass options and
@@ -132,12 +131,16 @@ the command reference (`choco -?`).
132131
Default push location is deprecated and will be removed by v2.0.0.
133132
It is recommended to always specify the source you want to push to
134133
using the `--source` argument.
134+
135+
Starting in v2.0.0 the shortcut `cpush` will be removed and can not be used
136+
to push packages anymore. We recommend you make sure that you always
137+
use the full command going forward (`choco push`).
135138
");
136139

137140
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
138141
"chocolatey".Log().Info(@"
139142
choco push [<path to nupkg>] [<options/switches>]
140-
cpush [<path to nupkg>] [<options/switches>]
143+
cpush [<path to nupkg>] [<options/switches>] (DEPRECATED, will be removed in v2.0.0)
141144
142145
NOTE: If there is more than one nupkg file in the folder, the command
143146
will require specifying the path to the file.

src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ public virtual void help_message(ChocolateyConfiguration configuration)
154154
{
155155
this.Log().Info(ChocolateyLoggers.Important, "Uninstall Command");
156156
this.Log().Info(@"
157-
Uninstalls a package or a list of packages. Some may prefer to use
158-
`cuninst` as a shortcut for `choco uninstall`.
157+
Uninstalls a package or a list of packages.
159158
160159
NOTE: 100% compatible with older chocolatey client (0.9.8.32 and below)
161160
with options and switches. Add `-y` for previous behavior with no
@@ -204,10 +203,17 @@ and licensed enhancements have the ability to inspect more locations
204203
to determine how to automatically uninstall software.
205204
");
206205

206+
"chocolatey".Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE");
207+
"chocolatey".Log().Warn(@"
208+
Starting in v2.0.0 the shortcut `cuninst` will be removed and can not be used
209+
to uninstall packages anymore. We recommend you make sure that you always
210+
use the full command going forward (`choco uninstall`).
211+
");
212+
207213
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
208214
"chocolatey".Log().Info(@"
209215
choco uninstall <pkg|all> [pkg2 pkgN] [options/switches]
210-
cuninst <pkg|all> [pkg2 pkgN] [options/switches]
216+
cuninst <pkg|all> [pkg2 pkgN] [options/switches] (DEPRECATED, will be removed in v2.0.0)
211217
212218
NOTE: `all` is a special package keyword that will allow you to
213219
uninstall all packages.

src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ public virtual void help_message(ChocolateyConfiguration configuration)
267267
{
268268
this.Log().Info(ChocolateyLoggers.Important, "Upgrade Command");
269269
this.Log().Info(@"
270-
Upgrades a package or a list of packages. Some may prefer to use `cup`
271-
as a shortcut for `choco upgrade`. If you do not have a package
270+
Upgrades a package or a list of packages. If you do not have a package
272271
installed, upgrade will install it.
273272
274273
NOTE: 100% compatible with older Chocolatey client (0.9.8.x and below)
@@ -277,10 +276,17 @@ prompt. In most cases you can still pass options and switches with one
277276
dash (`-`). For more details, see the command reference (`choco -?`).
278277
");
279278

279+
"chocolatey".Log().Warn(ChocolateyLoggers.Important, "DEPRECATION NOTICE");
280+
"chocolatey".Log().Warn(@"
281+
Starting in v2.0.0 the shortcut `cup` will be removed and can not be used
282+
to upgrade or install packages anymore. We recommend you make sure that you always
283+
use the full command going forward (`choco upgrade`).
284+
");
285+
280286
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
281287
"chocolatey".Log().Info(@"
282288
choco upgrade <pkg|all> [<pkg2> <pkgN>] [<options/switches>]
283-
cup <pkg|all> [<pkg2> <pkgN>] [<options/switches>]
289+
cup <pkg|all> [<pkg2> <pkgN>] [<options/switches>] (DEPRECATED, will be removed in v2.0.0)
284290
285291
NOTE: `all` is a special package keyword that will allow you to upgrade
286292
all currently installed packages.

0 commit comments

Comments
 (0)