Skip to content

Commit b5fa3ce

Browse files
Warn if no registry is available during pkg install prompt (#2865)
1 parent a882316 commit b5fa3ce

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/REPLMode/REPLMode.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,20 @@ Some commands have an alias, indicated below.
652652
end
653653

654654
const help = gen_help()
655+
const REG_WARNED = Ref{Bool}(false)
655656

656657
function try_prompt_pkg_add(pkgs::Vector{Symbol})
657658
ctx = Context()
659+
if isempty(ctx.registries)
660+
if !REG_WARNED[]
661+
printstyled(ctx.io, ""; color=:green)
662+
printstyled(ctx.io, "Attempted to search for missing packages in Pkg registries but no registries are installed.\n")
663+
printstyled(ctx.io, ""; color=:green)
664+
printstyled(ctx.io, "Use Pkg mode to install a registry. Both `pkg> add` and `pkg> update` will install the default registries.\n\n")
665+
REG_WARNED[] = true
666+
end
667+
return false
668+
end
658669
available_uuids = [Types.registered_uuids(ctx.registries, String(pkg)) for pkg in pkgs] # vector of vectors
659670
available_pkgs = pkgs[isempty.(available_uuids) .== false]
660671
isempty(available_pkgs) && return false

0 commit comments

Comments
 (0)