@@ -50,16 +50,18 @@ function is_pkgversion_yanked(entry::PackageEntry, registries::Vector{Registry.R
5050    return  is_pkgversion_yanked (entry. uuid, entry. version, registries)
5151end 
5252
53- function  is_pkg_deprecated (pkg:: Union{PackageSpec, PackageEntry} , registries:: Vector{Registry.RegistryInstance}  =  Registry. reachable_registries ())
54-     pkg. uuid ===  nothing  &&  return  false 
53+ function  get_pkg_deprecation_info (pkg:: Union{PackageSpec, PackageEntry} , registries:: Vector{Registry.RegistryInstance}  =  Registry. reachable_registries ())
54+     pkg. uuid ===  nothing  &&  return  nothing 
5555    for  reg in  registries
5656        reg_pkg =  get (reg, pkg. uuid, nothing )
5757        if  reg_pkg != =  nothing 
5858            info =  Registry. registry_info (reg_pkg)
59-             Registry. isdeprecated (info) &&  return  true 
59+             if  Registry. isdeprecated (info)
60+                 return  info. deprecated
61+             end 
6062        end 
6163    end 
62-     return  false 
64+     return  nothing 
6365end 
6466
6567function  default_preserve ()
@@ -2927,11 +2929,12 @@ struct PackageStatusData
29272929    compat_data:: Union{Nothing, Tuple{Vector{String}, VersionNumber, VersionNumber}} 
29282930    changed:: Bool 
29292931    extinfo:: Union{Nothing, Vector{ExtInfo}} 
2932+     deprecation_info:: Union{Nothing, Dict{String, Any}} 
29302933end 
29312934
29322935function  print_status (
29332936        env:: EnvCache , old_env:: Union{Nothing, EnvCache} , registries:: Vector{Registry.RegistryInstance} , header:: Symbol ,
2934-         uuids:: Vector , names:: Vector ; manifest =  true , diff =  false , ignore_indent:: Bool , workspace:: Bool , outdated:: Bool , extensions:: Bool , io:: IO ,
2937+         uuids:: Vector , names:: Vector ; manifest =  true , diff =  false , ignore_indent:: Bool , workspace:: Bool , outdated:: Bool , deprecated :: Bool ,  extensions:: Bool , io:: IO ,
29352938        mode:: PackageMode , hidden_upgrades_info:: Bool , show_usagetips:: Bool  =  true 
29362939    )
29372940    not_installed_indicator =  sprint ((io, args) ->  printstyled (io, args... ; color =  Base. error_color ()), " →" =  io)
@@ -3015,6 +3018,19 @@ function print_status(
30153018            continue 
30163019        end 
30173020
3021+         #  Deprecated info
3022+         deprecation_info =  nothing 
3023+         pkg_deprecated =  false 
3024+         if  ! isnothing (new)
3025+             pkg_spec =  something (new, old)
3026+             deprecation_info =  get_pkg_deprecation_info (pkg_spec, registries)
3027+             pkg_deprecated =  deprecation_info != =  nothing 
3028+         end 
3029+ 
3030+         #  if we are running with deprecated, only show packages that are deprecated
3031+         if  deprecated &&  ! pkg_deprecated
3032+             continue 
3033+         end 
30183034
30193035        #  TODO : Show extension deps for project as well?
30203036
@@ -3033,7 +3049,7 @@ function print_status(
30333049        no_visible_packages_heldback &=  (! changed ||  ! pkg_heldback)
30343050        no_packages_heldback &=  ! pkg_heldback
30353051
3036-         push! (package_statuses, PackageStatusData (uuid, old, new, pkg_downloaded, pkg_upgradable, pkg_heldback, cinfo, changed, ext_info))
3052+         push! (package_statuses, PackageStatusData (uuid, old, new, pkg_downloaded, pkg_upgradable, pkg_heldback, cinfo, changed, ext_info, deprecation_info ))
30373053    end 
30383054
30393055    for  pkg in  package_statuses
@@ -3067,10 +3083,22 @@ function print_status(
30673083        end 
30683084
30693085        #  show if package is deprecated
3070-         if  is_pkg_deprecated (pkg_spec, registries) 
3086+         if  pkg . deprecation_info  != =   nothing 
30713087            printstyled (io, "  [deprecated]" =  :yellow )
30723088        end 
30733089
3090+         #  show deprecation details when using --deprecated flag
3091+         if  deprecated &&  ! diff &&  pkg. deprecation_info != =  nothing 
3092+             reason =  get (pkg. deprecation_info, " reason" nothing )
3093+             alternative =  get (pkg. deprecation_info, " alternative" nothing )
3094+             if  reason != =  nothing 
3095+                 printstyled (io, "  (reason: " " )" =  :yellow )
3096+             end 
3097+             if  alternative != =  nothing 
3098+                 printstyled (io, "  (alternative: " " )" =  :yellow )
3099+             end 
3100+         end 
3101+ 
30743102        if  outdated &&  ! diff &&  pkg. compat_data != =  nothing 
30753103            packages_holding_back, max_version, max_version_compat =  pkg. compat_data
30763104            if  pkg. new. version != =  max_version_compat &&  max_version_compat !=  max_version
@@ -3161,6 +3189,17 @@ function print_status(
31613189        It is recommended to update them to resolve a valid version."""  , color =  Base. warn_color (), ignore_indent)
31623190    end 
31633191
3192+     #  Check if any packages are deprecated for info message
3193+     any_deprecated_packages =  any (pkg ->  pkg. deprecation_info != =  nothing , package_statuses)
3194+ 
3195+     #  Add info for deprecated packages (only if not already in deprecated mode)
3196+     if  ! deprecated &&  any_deprecated_packages
3197+         deprecated_str =  sprint ((io, args) ->  printstyled (io, args... ; color =  :yellow ), " [deprecated]" =  io)
3198+         tipend =  manifest ?  "  -m" :  " " 
3199+         tip =  show_usagetips ?  "  Use `status --deprecated$tipend ` to see more information." :  " " 
3200+         printpkgstyle (io, :Info , """ Packages marked with $deprecated_str  are no longer maintained.$tip """ =  Base. info_color (), ignore_indent)
3201+     end 
3202+ 
31643203    return  nothing 
31653204end 
31663205
@@ -3192,7 +3231,7 @@ end
31923231function  status (
31933232        env:: EnvCache , registries:: Vector{Registry.RegistryInstance} , pkgs:: Vector{PackageSpec}  =  PackageSpec[];
31943233        header =  nothing , mode:: PackageMode  =  PKGMODE_PROJECT, git_diff:: Bool  =  false , env_diff =  nothing , ignore_indent =  true ,
3195-         io:: IO , workspace:: Bool  =  false , outdated:: Bool  =  false , extensions:: Bool  =  false , hidden_upgrades_info:: Bool  =  false , show_usagetips:: Bool  =  true 
3234+         io:: IO , workspace:: Bool  =  false , outdated:: Bool  =  false , deprecated :: Bool   =   false ,  extensions:: Bool  =  false , hidden_upgrades_info:: Bool  =  false , show_usagetips:: Bool  =  true 
31963235    )
31973236    io ==  Base. devnull  &&  return 
31983237    #  if a package, print header
@@ -3223,10 +3262,10 @@ function status(
32233262    diff =  old_env != =  nothing 
32243263    header =  something (header, diff ?  :Diff  :  :Status )
32253264    if  mode ==  PKGMODE_PROJECT ||  mode ==  PKGMODE_COMBINED
3226-         print_status (env, old_env, registries, header, filter_uuids, filter_names; manifest =  false , diff, ignore_indent, io, workspace, outdated, extensions, mode, hidden_upgrades_info, show_usagetips)
3265+         print_status (env, old_env, registries, header, filter_uuids, filter_names; manifest =  false , diff, ignore_indent, io, workspace, outdated, deprecated,  extensions, mode, hidden_upgrades_info, show_usagetips)
32273266    end 
32283267    if  mode ==  PKGMODE_MANIFEST ||  mode ==  PKGMODE_COMBINED
3229-         print_status (env, old_env, registries, header, filter_uuids, filter_names; diff, ignore_indent, io, workspace, outdated, extensions, mode, hidden_upgrades_info, show_usagetips)
3268+         print_status (env, old_env, registries, header, filter_uuids, filter_names; diff, ignore_indent, io, workspace, outdated, deprecated,  extensions, mode, hidden_upgrades_info, show_usagetips)
32303269    end 
32313270    return  if  is_manifest_current (env) ===  false 
32323271        tip =  if  show_usagetips
0 commit comments