mirror of
https://github.com/endeavouros-team/eos-bash-shared.git
synced 2026-06-13 01:34:36 +00:00
[eos-bash-shared] eos-pkg-changelog: small improvement to bash-completion of changelogs
This commit is contained in:
+8
-1
@@ -41,7 +41,14 @@ DumpOptions() {
|
||||
}
|
||||
SourceClFile() {
|
||||
if [ "$clfile" ] ; then
|
||||
[ -e "$clfile" ] || DIE "given config file '$clfile' not found"
|
||||
if [ ! -e "$clfile" ] ; then
|
||||
if [ ! -e "/etc/changelogs.conf.$clfile" ] ; then
|
||||
DIE "given config file '$clfile' not found"
|
||||
else
|
||||
clfile="/etc/changelogs.conf.$clfile"
|
||||
echo "==> found $clfile" >&2
|
||||
fi
|
||||
fi
|
||||
source "$clfile" || DIE "reading $clfile failed" # get new PKG_CHANGELOGS and REPONAME
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -11,6 +11,18 @@ _eos-pkg-changelog_()
|
||||
local cur prev #words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
_eos-pkg-changelog_complete "$(eos-pkg-changelog --parameters)"
|
||||
case "$prev" in
|
||||
-c | --clfile)
|
||||
local files=(/etc/changelogs.conf.*)
|
||||
_eos-pkg-changelog_complete "${files[*]}"
|
||||
;;
|
||||
*)
|
||||
case "$cur" in
|
||||
*)
|
||||
_eos-pkg-changelog_complete "$(eos-pkg-changelog --parameters)"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _eos-pkg-changelog_ eos-pkg-changelog
|
||||
|
||||
Reference in New Issue
Block a user