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

fix path install #231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 8 additions & 9 deletions src/builder/rcfile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ function install_env_path(
yes::Bool = false,
)
rcfile = detect_rcfile(shell, home_dir)
let install_path = expanduser(options.install.path)
msg = "cannot detect $(options.install.path)/bin in PATH, do you want to add it in PATH?"
if !contains_path(rcfile, install_path, env) && Tools.prompt(msg; yes)
write_path(rcfile, install_path)
end
completions_dir(xs...) = install_path(options, "completions", xs...)

msg = "cannot detect $(options.install.path)/bin in PATH, do you want to add it in PATH?"
if !contains_path(rcfile, install_path(options), env) && Tools.prompt(msg; yes)
write_path(rcfile, install_path(options))
end

if shell == "bash"
completions_script =
install_path(options, "completions", options.name * "-" * "completion.bash")
completions_script = completions_dir(options.name * "-" * "completion.bash")
println("please add the following line in your $rcfile to enable shell autocompletion")
println(" source $completions_script")
println()
Expand All @@ -33,8 +32,8 @@ function install_env_path(

if shell == "zsh"
msg = "cannot detect $(options.install.path)/completions in FPATH, do you want to add it in FPATH?"
if !contains_fpath(rcfile, install_path, env) && Tools.prompt(msg; yes)
write_fpath(rcfile, install_path)
if !contains_fpath(rcfile, completions_dir(), env) && Tools.prompt(msg; yes)
write_fpath(rcfile, completions_dir())
end
end

Expand Down