Internal types
ShareAdd.EnvNull — Type
Used to denote that package is to be deleted (like moving to an environment analog of dev/null)
ShareAdd.EnvSet — Type
struct EnvSetenvs::Set{String}- set of environment namesextraneous_pks::Set{String}- (internally used, seeoptim_setfunction for details)extra_lng::Int- as aboveno_of_sets::Int- as above
ShareAdd.OptimSet — Type
mutable struct OptimSetbest_set::EnvSet- the best set of environments currently found - seeoptim_setfunction for details.
Internal functions
ShareAdd._collect_siblings! — Method
Recursively collect packages from workspace projects into result, skipping the project at current_dir and any names already in current_deps.
ShareAdd._find_parent_workspace — Method
_find_parent_workspace(project_file::String) -> Union{Nothing, String}Low-level helper: walk up from project_file looking for an immediate parent workspace that lists the project.
ShareAdd._locate_project_file — Method
_locate_project_file(dir) -> Union{Nothing, String}Return the path to the first JuliaProject.toml or Project.toml found in dir, or nothing.
ShareAdd._samedir — Method
Check whether two directory paths refer to the same location.
ShareAdd.activate_temp — Method
activate_temp()If current environment is a temporary one, does nothing. Otherwise activates a temporary environment. If the initial environment was a package (under development), makes this package available in the new environment by calling Pkg.develop.
Returns nothing.
ShareAdd.check_packages — Method
check_packages(packages; depot = first(DEPOT_PATH)) -> NamedTuplechecks whether packages are available in the current environment, shared environments, or are installable.
Returns a NamedTuple with the following fields:
inpath_pkgs: packages that are already present in some environment inLOAD_PATHinshared_pkgs: packages that are available in some shared environmentsinstallable_pkgs: available packagesunavailable_pkgs: packages that are not available from any registryshared_pkgs: Dictionary of packages in shared environmentscurrent_pr: information about the current environment as@NamedTuple{name::String, shared::Bool}
ShareAdd.check_workspace_packages — Method
check_workspace_packages(packages, current_project::String)
-> (workspace_pkgs::Vector{String}, workspace_paths::Dict{String,String})Check which of the requested packages are available through workspace siblings of the environment at current_project.
Returns a tuple of:
workspace_pkgs– the subset ofpackagesfound in workspace siblingsworkspace_paths– mapping from each such package name to the sibling project directory that provides it
ShareAdd.cleanup_testenvs — Method
Removes folders created in the ~/.julia/environments/ folder during the testing. Used in the test suite, but also on the package startup just for the case the test errored.
ShareAdd.delete_shared_env — Method
delete_shared_env(env::Union{AbstractString, EnvInfo}; force = SKIPPING)Deletes the shared environment env by erasing it's directory. Set force=FORCING if you want to delete the environment even if it is currently in LOAD_PATH.
Returns true, if the environment has been deleted, and false otherwise.
ShareAdd.delete_shared_pkg — Method
delete_shared_pkg(pkg::AbstractString; inall, force)
delete_shared_pkg(p::Pair{EnvInfo, <:AbstractString}; force)
delete_shared_pkg(p::Pair{<:AbstractString, <:AbstractString}; force)Deletes the package pkg from it's shared environment. Deletes this environment if it was the only package there. If the package may be present in multiple environments, and you want to delete it from all of them, set inall=true. Set force=true if you want to delete the package even if it is currently loaded, and it's env, in case it is empty then, even if it is in LOAD_PATH.
Returns NamedTuple (; success, nowempty), where `nowempty` is a flag for the containing environment being now empty.
ShareAdd.env_folders — Method
env_folders(; depot = first(DEPOT_PATH), create=false) ->
(; envs_folder, main_env, envs_exist)Returns a named tuple containing the path to the main folder holding all share environments, the path to the main shared environment, and a boolean indicating whether the main environment folder exists.
If create=true, the main environment folder will be created if it does not exist.
ShareAdd.env_path — Function
env_path(env_name::AbstractString, depot = first(DEPOT_PATH); skipfirstchar = true) -> StringReturns the path of the environment with name env_name. If skipfirstchar is true, the first character of env_name is skipped, so that the name of a shared environment can be passed without the leading @.
ShareAdd.find_workspace_root — Method
find_workspace_root(project_file::String) -> Union{Nothing, String}Find the root Project.toml of the workspace containing project_file. Returns nothing if project_file is not part of any workspace, or if running on Julia < 1.12.
Walks up the directory tree from project_file, looking for a parent Project.toml whose [workspace].projects lists a path that resolves to the directory of project_file. Stops at the filesystem root or when leaving homedir() (if the search started inside it).
Handles nested workspaces by repeating the upward search from each discovered root.
ShareAdd.fn2string — Method
converts function or macro name to string
ShareAdd.list_shared_envs — Method
list_shared_envs() -> Vector{String}
list_shared_envs(pkg_name) -> Vector{String}Returns the names of all shared environments (if called without an argument), or the environment(s) containing the package pkg_name.
ShareAdd.list_shared_packages — Method
list_shared_packages(;depot = first(DEPOT_PATH)) -> Dict{String, PackageInfo}ShareAdd.optim_set — Method
optim_set(pks::AbstractArray{<:AbstractString}, envs::AbstractVector{EnvInfo}) -> OptimSet
optim_set(pkgs::AbstractArray{PackageInfo}) -> OptimSetFinds the optimum set of environments for the given list of packages. Optimal is a set of environments with the least number of extraneous packages. If two sets have the same number of extraneous packages, then the one with the least number of environments is chosen.
The function is internal.
ShareAdd.prompt2install — Function
prompt2install(new_package::AbstractString, args...; kwargs...) -> Union{Nothing, String, EnvInfo, EnvNull}Will return ENV_NULL to indicate that package is not to be installed in any environment (in using by tidyup)
ShareAdd.prompt2install — Method
prompt2install(packages::AbstractVector{<:AbstractString})
prompt2install(package::AbstractString)Prompt user to select a shared environment to install a package or packages.
For a single package, if the user selects an environment, the package will be installed there. If the user selects "A new shared environment (you will be prompted for the name)", the user will be prompted to enter a name for a new environment.
For multiple packages, the function will be called on each package and the user will be prompted for each package.
The function will return a vector of NamedTuples, each with field pkg and env, where pkg is the name of the package and env is the environment where it should be installed.
The function will return nothing if the user selects "Quit. Do Nothing." on any of the prompts.
ShareAdd.shared_environments_envinfos — Method
shared_environments_envinfos(; std_lib=false, depot = first(DEPOT_PATH)) ->
(; shared_envs::Dict{name, EnvInfo},
envs_folder_path::String,
shared_env_names::Vector{String})ShareAdd.showenv — Method
actual function is in the DesktopExt extension
ShareAdd.update_all — Method
updated all shared environments and the current project
ShareAdd.update_all_envs — Method
updates all shared environments currently in LOAD_PATH
ShareAdd.workspace_sibling_packages — Method
workspace_sibling_packages(root_project::String, current_project::String)
-> Dict{String, String}Given the path to a workspace root Project.toml and the path to the currently active Project.toml, return a Dict that maps every package name reachable through workspace sibling projects to the directory of the sibling project that provides it.
"Reachable" means the package is either the sibling itself (it has name and uuid fields) or one of its declared [deps]. Packages that are already in the current project's [deps] are excluded.
Index
ShareAdd.EnvInfoShareAdd.EnvNullShareAdd.EnvSetShareAdd.OptimSetShareAdd.PackageInfoShareAdd.SkipAskForceEnumShareAdd._collect_siblings!ShareAdd._find_parent_workspaceShareAdd._locate_project_fileShareAdd._samedirShareAdd.activate_tempShareAdd.check_packagesShareAdd.check_workspace_packagesShareAdd.cleanup_testenvsShareAdd.current_envShareAdd.deleteShareAdd.delete_shared_envShareAdd.delete_shared_pkgShareAdd.env_foldersShareAdd.env_pathShareAdd.find_workspace_rootShareAdd.fn2stringShareAdd.infoShareAdd.list_shared_envsShareAdd.list_shared_packagesShareAdd.make_current_mnfShareAdd.make_importableShareAdd.optim_setShareAdd.prompt2installShareAdd.prompt2installShareAdd.resetShareAdd.sh_addShareAdd.shared_environments_envinfosShareAdd.showenvShareAdd.tidyupShareAdd.updateShareAdd.update_allShareAdd.update_all_envsShareAdd.workspace_sibling_packagesShareAdd.@showenvShareAdd.@usinganyShareAdd.@usingtmp