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 Pkg repl mode tips when interactive #53823

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,8 @@ function __require(into::Module, mod::Symbol)
hint_message = hint ? ", maybe you meant `import/using $(dots)$(mod)`" : ""
install_message = if mod != :Pkg
start_sentence = hint ? "Otherwise, run" : "Run"
"\n- $start_sentence `import Pkg; Pkg.add($(repr(String(mod))))` to install the $mod package."
pkg_cmd = isinteractive() ? "pkg> add $mod" : "import Pkg; Pkg.add(\"$mod\")"
"\n- $start_sentence `$pkg_cmd` to install the $mod package."
else # for some reason Pkg itself isn't availability so do not tell them to use Pkg to install it.
""
end
Expand Down
3 changes: 2 additions & 1 deletion stdlib/Artifacts/src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ function _artifact_str(__module__, artifacts_toml, name, path_tail, artifact_dic
suggestion_str = if query_override(hash) !== nothing
"Check that your `Overrides.toml` file is correct (https://pkgdocs.julialang.org/v1/artifacts/#Overriding-artifact-locations)."
else
"Try `using Pkg; Pkg.instantiate()` to re-install all missing resources if the artifact is part of a package \
pkg_cmd = Base.isinteractive() ? "pkg> instantiate" : "import Pkg; Pkg.instantiate()"
"Try `$pkg_cmd` to re-install all missing resources if the artifact is part of a package \
or call `Pkg.ensure_artifact_installed` (https://pkgdocs.julialang.org/v1/api/#Pkg.Artifacts.ensure_artifact_installed) if not."
end

Expand Down