Internal types
ShareAdd.EnvSet
— Typestruct EnvSet
envs::Set{String}
- set of environment namesextraneous_pks::Set{String}
- (internally used, seeoptim_set
function for details)extra_lng::Int
- as aboveno_of_sets::Int
- as above
ShareAdd.OptimSet
— Typemutable struct OptimSet
best_set::EnvSet
- the best set of environments currently found - seeoptim_set
function for details.
Internal functions
ShareAdd.activate_temp
— Methodactivate_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
— Methodcheck_packages(packages; depot = first(DEPOT_PATH)) -> NamedTuple
checks 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_PATH
inshared_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.cleanup_testenvs
— MethodRemoves 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
— Methoddelete_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
— Methoddelete_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
— Methodenv_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
— Functionenv_path(env_name::AbstractString, depot = first(DEPOT_PATH); skipfirstchar = true) -> String
Returns 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.fn2string
— Methodconverts function or macro name to string
ShareAdd.list_shared_envs
— Methodlist_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
— Methodlist_shared_packages(;depot = first(DEPOT_PATH)) -> Dict{String, PackageInfo}
ShareAdd.optim_set
— Methodoptim_set(pks::AbstractArray{<:AbstractString}, envs::AbstractVector{EnvInfo}) -> OptimSet
optim_set(pkgs::AbstractArray{PackageInfo}) -> OptimSet
Finds 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
— Methodprompt2install(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
— Methodshared_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
— Methodactual function is in the DesktopExt extension
ShareAdd.update_all
— Methodupdated all shared environments and the current project
ShareAdd.update_all_envs
— Methodupdates all shared environments currently in LOAD_PATH
Index
ShareAdd.EnvInfo
ShareAdd.EnvSet
ShareAdd.OptimSet
ShareAdd.PackageInfo
ShareAdd.SkipAskForceEnum
ShareAdd.activate_temp
ShareAdd.check_packages
ShareAdd.cleanup_testenvs
ShareAdd.current_env
ShareAdd.delete
ShareAdd.delete_shared_env
ShareAdd.delete_shared_pkg
ShareAdd.env_folders
ShareAdd.env_path
ShareAdd.fn2string
ShareAdd.info
ShareAdd.list_shared_envs
ShareAdd.list_shared_packages
ShareAdd.make_current_mnf
ShareAdd.make_importable
ShareAdd.optim_set
ShareAdd.prompt2install
ShareAdd.reset
ShareAdd.sh_add
ShareAdd.shared_environments_envinfos
ShareAdd.showenv
ShareAdd.update
ShareAdd.update_all
ShareAdd.update_all_envs
ShareAdd.@showenv
ShareAdd.@usingany
ShareAdd.@usingtmp