Skip to content

Commit

Permalink
zsh: remove unit property caching
Browse files Browse the repository at this point in the history
The existing caching policy isn't very sensible for this cache. We could
write a different policy, but I don't think there is much value in
caching these values, as in my experience the command used to generate
them is quick.
  • Loading branch information
rpigott committed Jul 19, 2023
1 parent 110ba0c commit ae6fb82
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions shell-completion/zsh/_systemctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,9 @@ done

(( $+functions[_systemctl_unit_properties] )) ||
_systemctl_unit_properties() {
if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES$_sys_service_mgr ) ||
! _retrieve_cache SYS_ALL_PROPERTIES$_sys_service_mgr;
then
_sys_all_properties=( ${${(M)${(f)"$({{ROOTLIBEXECDIR}}/systemd --dump-bus-properties)"}}} )
_store_cache SYS_ALL_PROPERTIES$_sys_service_mgr _sys_all_properties
fi
_values -s , "${_sys_all_properties[@]}"
local -a _sys_all_properties=( ${(f)"$({{ROOTLIBEXECDIR}}/systemd --no-pager --dump-bus-properties 2>/dev/null)"} )
_wanted systemd-unit-properties expl 'unit property' \
_values -s , "${_sys_all_properties[@]}"
}

(( $+functions[_systemctl_job_modes] )) ||
Expand Down

0 comments on commit ae6fb82

Please sign in to comment.