Add perl-info function & plenv subcommand aliases (#1303)
* Add perl-info function * Add alias for plenv subcommands * Load perlbrew if needed * Load plenv if needed * Use PERLBREW_ROOT as priority to detect Perlbrewpull/1306/head
parent
fb37539f43
commit
cf7d3cffbd
@ -0,0 +1,30 @@
|
|||||||
|
#
|
||||||
|
# Exposes information about the Perl environment via the $perl_info associative
|
||||||
|
# array.
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
# JINNOUCHI Yasushi <delphinus@remora.cx>
|
||||||
|
#
|
||||||
|
|
||||||
|
local version
|
||||||
|
local version_format
|
||||||
|
local version_formatted
|
||||||
|
|
||||||
|
# Clean up previous $perl_info.
|
||||||
|
unset perl_info
|
||||||
|
typeset -gA perl_info
|
||||||
|
|
||||||
|
if (( $+commands[perlbrew] )); then
|
||||||
|
version="${PERLBREW_PERL##*perl-}"
|
||||||
|
elif (( $+commands[plenv] )); then
|
||||||
|
version=$(plenv version-name)
|
||||||
|
elif (( $+commands[perl] )); then
|
||||||
|
version=$(perl -e 'printf "%vd", $^V')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Format version.
|
||||||
|
if [[ -n "$version" ]]; then
|
||||||
|
zstyle -s ':prezto:module:perl:info:version' format 'version_format'
|
||||||
|
zformat -f version_formatted "$version_format" "v:$version"
|
||||||
|
perl_info[version]="$version_formatted"
|
||||||
|
fi
|
Loading…
Reference in new issue