Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

give interactive mode tips when interactive #3854

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1321,14 +1321,14 @@ function assert_can_add(ctx::Context, pkgs::Vector{PackageSpec})
existing_uuid == pkg.uuid ||
pkgerror("""Refusing to add package $(err_rep(pkg)).
Package `$(pkg.name)=$(existing_uuid)` with the same name already exists as a direct dependency.
To remove the existing package, use `import Pkg; Pkg.rm("$(pkg.name)")`.
To remove the existing package, use `$(Base.isinteractive() ? """pkg> rm $(pkg.name)""" : """import Pkg; Pkg.rm("$(pkg.name)")""")`.
""")
# package with the same uuid exist in the project: assert they have the same name
name = findfirst(==(pkg.uuid), ctx.env.project.deps)
name === nothing || name == pkg.name ||
pkgerror("""Refusing to add package $(err_rep(pkg)).
Package `$name=$(pkg.uuid)` with the same UUID already exists as a direct dependency.
To remove the existing package, use `import Pkg; Pkg.rm("$name")`.
To remove the existing package, use `$(Base.isinteractive() ? """pkg> rm $name""" : """import Pkg; Pkg.rm("$name")""")`.
""")
# package with the same uuid exist in the manifest: assert they have the same name
entry = get(ctx.env.manifest, pkg.uuid, nothing)
Expand Down
3 changes: 2 additions & 1 deletion src/Registry/Registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ function check_registry_state(reg)
reg_currently_uses_pkg_server = reg.tree_info !== nothing
reg_should_use_pkg_server = registry_use_pkg_server()
if reg_currently_uses_pkg_server && !reg_should_use_pkg_server
pkg_cmd = Base.isinteractive() ? "pkg> rm $(reg.name); add $(reg.name)" : "using Pkg; Pkg.Registry.rm(\"$(reg.name)\"); Pkg.Registry.add(\"$(reg.name)\")"
msg = string(
"Your registry may be outdated. We recommend that you run the ",
"following command: ",
"using Pkg; Pkg.Registry.rm(\"$(reg.name)\"); Pkg.Registry.add(\"$(reg.name)\")",
pkg_cmd,
)
@warn(msg)
end
Expand Down
Loading