147147
148148# Provide some convenience calls
149149for f in (:develop , :add , :rm , :up , :pin , :free , :test , :build , :status , :why , :precompile )
150+ f_under = Symbol (" _" , f)
150151 @eval begin
151152 $ f (pkg:: Union{AbstractString, PackageSpec} ; kwargs... ) = $ f ([pkg]; kwargs... )
152153 $ f (pkgs:: Vector{<:AbstractString} ; kwargs... ) = $ f ([PackageSpec (pkg) for pkg in pkgs]; kwargs... )
@@ -161,12 +162,12 @@ for f in (:develop, :add, :rm, :up, :pin, :free, :test, :build, :status, :why, :
161162 kwargs = merge ((;kwargs... ), (:io => io,))
162163 pkgs = deepcopy (pkgs) # don't mutate input
163164 foreach (handle_package_input!, pkgs)
164- ret = $ f (ctx, pkgs; kwargs... )
165+ ret = $ f_under (ctx, pkgs; kwargs... ) # note the underscore for private entrypoint
165166 $ (f in (:up , :pin , :free , :build )) && Pkg. _auto_precompile (ctx)
166167 $ (f in (:up , :pin , :free , :rm )) && Pkg. _auto_gc (ctx)
167168 return ret
168169 end
169- $ f (ctx:: Context ; kwargs... ) = $ f (ctx, PackageSpec[]; kwargs... )
170+ $ f_under (ctx:: Context ; kwargs... ) = $ f_under (ctx, PackageSpec[]; kwargs... )
170171 function $f (; name:: Union{Nothing,AbstractString} = nothing , uuid:: Union{Nothing,String,UUID} = nothing ,
171172 version:: Union{VersionNumber, String, VersionSpec, Nothing} = nothing ,
172173 url= nothing , rev= nothing , path= nothing , mode= PKGMODE_PROJECT, subdir= nothing , kwargs... )
@@ -218,7 +219,7 @@ function update_source_if_set(project, pkg)
218219 end
219220end
220221
221- function develop (ctx:: Context , pkgs:: Vector{PackageSpec} ; shared:: Bool = true ,
222+ function _develop (ctx:: Context , pkgs:: Vector{PackageSpec} ; shared:: Bool = true ,
222223 preserve:: PreserveLevel = Operations. default_preserve (), platform:: AbstractPlatform = HostPlatform (), kwargs... )
223224 require_not_empty (pkgs, :develop )
224225 Context! (ctx; kwargs... )
@@ -264,7 +265,7 @@ function develop(ctx::Context, pkgs::Vector{PackageSpec}; shared::Bool=true,
264265 return
265266end
266267
267- function add (ctx:: Context , pkgs:: Vector{PackageSpec} ; preserve:: PreserveLevel = Operations. default_preserve (),
268+ function _add (ctx:: Context , pkgs:: Vector{PackageSpec} ; preserve:: PreserveLevel = Operations. default_preserve (),
268269 platform:: AbstractPlatform = HostPlatform (), target:: Symbol = :deps , allow_autoprecomp:: Bool = true , kwargs... )
269270 require_not_empty (pkgs, :add )
270271 Context! (ctx; kwargs... )
@@ -318,7 +319,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}; preserve::PreserveLevel=Op
318319 return
319320end
320321
321- function rm (ctx:: Context , pkgs:: Vector{PackageSpec} ; mode= PKGMODE_PROJECT, all_pkgs:: Bool = false , kwargs... )
322+ function _rm (ctx:: Context , pkgs:: Vector{PackageSpec} ; mode= PKGMODE_PROJECT, all_pkgs:: Bool = false , kwargs... )
322323 Context! (ctx; kwargs... )
323324 if all_pkgs
324325 ! isempty (pkgs) && pkgerror (" cannot specify packages when operating on all packages" )
@@ -364,7 +365,7 @@ function append_all_pkgs!(pkgs, ctx, mode)
364365 return
365366end
366367
367- function up (ctx:: Context , pkgs:: Vector{PackageSpec} ;
368+ function _up (ctx:: Context , pkgs:: Vector{PackageSpec} ;
368369 level:: UpgradeLevel = UPLEVEL_MAJOR, mode:: PackageMode = PKGMODE_PROJECT,
369370 preserve:: Union{Nothing,PreserveLevel} = isempty (pkgs) ? nothing : PRESERVE_ALL,
370371 update_registry:: Bool = true ,
@@ -394,13 +395,13 @@ function up(ctx::Context, pkgs::Vector{PackageSpec};
394395 return
395396end
396397
397- resolve (; io:: IO = stderr_f (), kwargs... ) = resolve (Context (;io); kwargs... )
398- function resolve (ctx:: Context ; skip_writing_project:: Bool = false , kwargs... )
399- up (ctx; level= UPLEVEL_FIXED, mode= PKGMODE_MANIFEST, update_registry= false , skip_writing_project, kwargs... )
398+ resolve (; io:: IO = stderr_f (), kwargs... ) = _resolve (Context (;io); kwargs... )
399+ function _resolve (ctx:: Context ; skip_writing_project:: Bool = false , kwargs... )
400+ _up (ctx; level= UPLEVEL_FIXED, mode= PKGMODE_MANIFEST, update_registry= false , skip_writing_project, kwargs... )
400401 return nothing
401402end
402403
403- function pin (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
404+ function _pin (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
404405 Context! (ctx; kwargs... )
405406 if all_pkgs
406407 ! isempty (pkgs) && pkgerror (" cannot specify packages when operating on all packages" )
@@ -435,7 +436,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwar
435436 return
436437end
437438
438- function free (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
439+ function _free (ctx:: Context , pkgs:: Vector{PackageSpec} ; all_pkgs:: Bool = false , kwargs... )
439440 Context! (ctx; kwargs... )
440441 if all_pkgs
441442 ! isempty (pkgs) && pkgerror (" cannot specify packages when operating on all packages" )
@@ -462,7 +463,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwa
462463 return
463464end
464465
465- function test (ctx:: Context , pkgs:: Vector{PackageSpec} ;
466+ function _test (ctx:: Context , pkgs:: Vector{PackageSpec} ;
466467 coverage= false , test_fn= nothing ,
467468 julia_args:: Union{Cmd, AbstractVector{<:AbstractString}} = ` ` ,
468469 test_args:: Union{Cmd, AbstractVector{<:AbstractString}} = ` ` ,
@@ -526,7 +527,11 @@ admin privileges depending on the setup).
526527
527528Use verbose mode (`verbose=true`) for detailed output.
528529"""
529- function gc (ctx:: Context = Context (); collect_delay:: Period = Day (7 ), verbose= false , force= false , kwargs... )
530+ function gc (; collect_delay:: Period = Day (7 ), verbose= false , force= false , kwargs... )
531+ ctx = Context ()
532+ return _gc (ctx; collect_delay, verbose, force, kwargs... )
533+ end
534+ function _gc (ctx:: Context ; collect_delay:: Period = Day (7 ), verbose:: Bool = false , force:: Bool = false , kwargs... )
530535 Context! (ctx; kwargs... )
531536 env = ctx. env
532537
@@ -1097,7 +1102,7 @@ function gc(ctx::Context=Context(); collect_delay::Period=Day(7), verbose=false,
10971102 return
10981103end
10991104
1100- function build (ctx:: Context , pkgs:: Vector{PackageSpec} ; verbose= false , kwargs... )
1105+ function _build (ctx:: Context , pkgs:: Vector{PackageSpec} ; verbose= false , kwargs... )
11011106 Context! (ctx; kwargs... )
11021107
11031108 if isempty (pkgs)
@@ -1134,7 +1139,7 @@ function get_or_make_pkgspec(pkgspecs::Vector{PackageSpec}, ctx::Context, uuid)
11341139 end
11351140end
11361141
1137- function precompile (ctx:: Context , pkgs:: Vector{PackageSpec} ; internal_call:: Bool = false ,
1142+ function _precompile (ctx:: Context , pkgs:: Vector{PackageSpec} ; internal_call:: Bool = false ,
11381143 strict:: Bool = false , warn_loaded = true , already_instantiated = false , timing:: Bool = false ,
11391144 _from_loading:: Bool = false , configs:: Union{Base.Precompilation.Config,Vector{Base.Precompilation.Config}} = (` ` => Base. CacheFlags ()),
11401145 workspace:: Bool = false , kwargs... )
@@ -1199,7 +1204,7 @@ function instantiate(ctx::Context; manifest::Union{Bool, Nothing}=nothing,
11991204 if (! isfile (ctx. env. manifest_file) && manifest === nothing ) || manifest == false
12001205 # given no manifest exists, only allow invoking a registry update if there are project deps
12011206 allow_registry_update = isfile (ctx. env. project_file) && ! isempty (ctx. env. project. deps)
1202- up (ctx; update_registry = update_registry && allow_registry_update)
1207+ _up (ctx; update_registry = update_registry && allow_registry_update)
12031208 allow_autoprecomp && Pkg. _auto_precompile (ctx, already_instantiated = true )
12041209 return
12051210 end
@@ -1289,7 +1294,7 @@ end
12891294
12901295@deprecate status (mode:: PackageMode ) status (mode= mode)
12911296
1292- function status (ctx:: Context , pkgs:: Vector{PackageSpec} ; diff:: Bool = false , mode= PKGMODE_PROJECT, workspace:: Bool = false , outdated:: Bool = false , compat:: Bool = false , extensions:: Bool = false , io:: IO = stdout_f ())
1297+ function _status (ctx:: Context , pkgs:: Vector{PackageSpec} ; diff:: Bool = false , mode= PKGMODE_PROJECT, workspace:: Bool = false , outdated:: Bool = false , compat:: Bool = false , extensions:: Bool = false , io:: IO = stdout_f ())
12931298 if compat
12941299 diff && pkgerror (" Compat status has no `diff` mode" )
12951300 outdated && pkgerror (" Compat status has no `outdated` mode" )
@@ -1392,7 +1397,7 @@ function activate(f::Function, new_project::AbstractString)
13921397 end
13931398end
13941399
1395- function compat (ctx:: Context , pkg:: String , compat_str:: Union{Nothing,String} ; io = nothing , kwargs... )
1400+ function _compat (ctx:: Context , pkg:: String , compat_str:: Union{Nothing,String} ; io = nothing , kwargs... )
13961401 io = something (io, ctx. io)
13971402 pkg = pkg == " Julia" ? " julia" : pkg
13981403 isnothing (compat_str) || (compat_str = string (strip (compat_str, ' "' )))
@@ -1429,7 +1434,7 @@ compat(;kwargs...) = compat(Context(); kwargs...)
14291434# why #
14301435# ######
14311436
1432- function why (ctx:: Context , pkgs:: Vector{PackageSpec} ; io:: IO , workspace:: Bool = false , kwargs... )
1437+ function _why (ctx:: Context , pkgs:: Vector{PackageSpec} ; io:: IO , workspace:: Bool = false , kwargs... )
14331438 require_not_empty (pkgs, :why )
14341439
14351440 manifest_resolve! (ctx. env. manifest, pkgs)
0 commit comments