Skip to content

Commit 89286ea

Browse files
Improve messaging in --all noops (#2871)
1 parent 22872d6 commit 89286ea

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/API.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@ function rm(ctx::Context, pkgs::Vector{PackageSpec}; mode=PKGMODE_PROJECT, all_p
280280
if all_pkgs
281281
!isempty(pkgs) && pkgerror("cannot specify packages when operating on all packages")
282282
append_all_pkgs!(pkgs, ctx, mode)
283+
else
284+
require_not_empty(pkgs, :rm)
283285
end
284-
require_not_empty(pkgs, :rm)
285286

286287
for pkg in pkgs
287288
if pkg.name === nothing && pkg.uuid === nothing
@@ -352,8 +353,9 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwar
352353
if all_pkgs
353354
!isempty(pkgs) && pkgerror("cannot specify packages when operating on all packages")
354355
append_all_pkgs!(pkgs, ctx, PKGMODE_PROJECT)
356+
else
357+
require_not_empty(pkgs, :pin)
355358
end
356-
require_not_empty(pkgs, :pin)
357359

358360
for pkg in pkgs
359361
if pkg.name === nothing && pkg.uuid === nothing
@@ -383,8 +385,9 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwa
383385
if all_pkgs
384386
!isempty(pkgs) && pkgerror("cannot specify packages when operating on all packages")
385387
append_all_pkgs!(pkgs, ctx, PKGMODE_PROJECT)
388+
else
389+
require_not_empty(pkgs, :free)
386390
end
387-
require_not_empty(pkgs, :free)
388391

389392
for pkg in pkgs
390393
if pkg.name === nothing && pkg.uuid === nothing

test/new.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,11 @@ end
18681868
end
18691869
Pkg.rm(all_pkgs = true)
18701870
@test !haskey(Pkg.dependencies(), exuuid)
1871+
1872+
# test that the noops don't error
1873+
Pkg.rm(all_pkgs = true)
1874+
Pkg.pin(all_pkgs = true)
1875+
Pkg.free(all_pkgs = true)
18711876
end
18721877
isolate() do
18731878
Pkg.REPLMode.TEST_MODE[] = true

0 commit comments

Comments
 (0)