[eos-bash-shared] eos-pkg-changelog: small improvement to bash-completion of changelogs

This commit is contained in:
manuel
2025-04-12 10:24:26 +03:00
parent 1207154d36
commit dcda5ff328
2 changed files with 21 additions and 2 deletions
+8 -1
View File
@@ -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
+13 -1
View File
@@ -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