Use zsh's own make completion
OBS-URL: https://build.opensuse.org/package/show/shells/zsh?expand=0&rev=52
This commit is contained in:
parent
23839d999c
commit
fcd3969311
58
_make
58
_make
@ -1,58 +0,0 @@
|
|||||||
#compdef make gmake pmake dmake
|
|
||||||
|
|
||||||
local prev="$words[CURRENT-1]" file expl tmp is_gnu cmdargs useperl
|
|
||||||
|
|
||||||
zstyle -t ":completion:${curcontext}:" use-perl && useperl=1
|
|
||||||
_pick_variant -r is_gnu gnu=GNU unix -v -f
|
|
||||||
|
|
||||||
if [[ "$prev" = -[CI] ]]; then
|
|
||||||
_files -/
|
|
||||||
elif [[ "$prev" = -[foW] ]]; then
|
|
||||||
_files
|
|
||||||
else
|
|
||||||
file="$words[(I)-f]"
|
|
||||||
if (( file )); then
|
|
||||||
file="$words[file+1]"
|
|
||||||
elif [[ -e Makefile ]]; then
|
|
||||||
file=Makefile
|
|
||||||
elif [[ -e makefile ]]; then
|
|
||||||
file=makefile
|
|
||||||
elif [[ $is_gnu = gnu && -e GNUmakefile ]]; then
|
|
||||||
file=GNUmakefile
|
|
||||||
else
|
|
||||||
file=''
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$file" ]] && _tags targets; then
|
|
||||||
if [[ $is_gnu = gnu ]] &&
|
|
||||||
zstyle -t ":completion:${curcontext}:targets" call-command; then
|
|
||||||
if [[ -n $useperl ]]; then
|
|
||||||
cmdargs=(perl -F: -ane '/^[a-zA-Z0-9][^\/\t=]+:/ && print "$F[0]\n"')
|
|
||||||
else
|
|
||||||
cmdargs=(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:)
|
|
||||||
fi
|
|
||||||
tmp=( $(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null | $cmdargs) )
|
|
||||||
elif [[ -n $useperl ]]; then
|
|
||||||
tmp=(
|
|
||||||
$(perl -ne '@matches = /^(?:([a-zA-Z0-9]+[^\/\t=\s]+)\s*)+:/ and
|
|
||||||
print join(" ", @matches);
|
|
||||||
if (/^\.include\s+\<bsd\.port\.(subdir\.|pre\.)?mk>/ ||
|
|
||||||
/^\.include\s+\".*mk\/bsd\.pkg\.(subdir\.)?mk\"/) {
|
|
||||||
print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum\n";
|
|
||||||
}
|
|
||||||
' $file)
|
|
||||||
)
|
|
||||||
else
|
|
||||||
tmp=(
|
|
||||||
$(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
|
|
||||||
/^\.include *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
|
|
||||||
print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
|
|
||||||
FS=: $file)
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
_wanted targets expl 'make target' compadd -a tmp && return 0
|
|
||||||
fi
|
|
||||||
compstate[parameter]="${PREFIX%%\=*}"
|
|
||||||
compset -P 1 '*='
|
|
||||||
_value "$@"
|
|
||||||
fi
|
|
3
zsh.spec
3
zsh.spec
@ -30,7 +30,6 @@ Source2: zshenv
|
|||||||
Source3: _yast2
|
Source3: _yast2
|
||||||
Source4: _SuSEconfig
|
Source4: _SuSEconfig
|
||||||
Source5: _hwinfo
|
Source5: _hwinfo
|
||||||
Source6: _make
|
|
||||||
Source7: zprofile
|
Source7: zprofile
|
||||||
Source8: _osc
|
Source8: _osc
|
||||||
Source9: _zypper
|
Source9: _zypper
|
||||||
@ -109,7 +108,7 @@ make check
|
|||||||
# install SUSE configuration
|
# install SUSE configuration
|
||||||
install -m 0755 -Dd %{buildroot}/{etc,bin}
|
install -m 0755 -Dd %{buildroot}/{etc,bin}
|
||||||
install -m 0644 %{SOURCE1} %{SOURCE2} %{SOURCE7} %{buildroot}/etc
|
install -m 0644 %{SOURCE1} %{SOURCE2} %{SOURCE7} %{buildroot}/etc
|
||||||
install -m 0644 %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE8} %{SOURCE9} %{buildroot}%{_datadir}/%{name}/%{version}/functions
|
install -m 0644 %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE8} %{SOURCE9} %{buildroot}%{_datadir}/%{name}/%{version}/functions
|
||||||
# install help files
|
# install help files
|
||||||
install -m 0755 -Dd %{buildroot}%{_datadir}/%{name}/%{version}/help
|
install -m 0755 -Dd %{buildroot}%{_datadir}/%{name}/%{version}/help
|
||||||
install -m 0644 Help/* %{buildroot}%{_datadir}/%{name}/%{version}/help/
|
install -m 0644 Help/* %{buildroot}%{_datadir}/%{name}/%{version}/help/
|
||||||
|
Loading…
Reference in New Issue
Block a user