Compare commits

...

3 Commits

Author SHA1 Message Date
12d1b784ff bash completion changes (#149)
All checks were successful
Artools shellcheck / lint (push) Successful in 24s
fix package completion. other changes to match latest interface.

Reviewed-on: #149
Co-authored-by: Cory Sanin <corysanin@artixlinux.org>
Co-committed-by: Cory Sanin <corysanin@artixlinux.org>
2025-05-07 18:02:46 +02:00
d8129cbb9a artixpkg: git add jenkinsfile if modified on move
All checks were successful
Artools shellcheck / lint (push) Successful in 25s
2025-05-05 23:20:28 +02:00
950e0604a4 artixpkg: fix repo import upstream fetch
All checks were successful
Artools shellcheck / lint (push) Successful in 55s
2025-05-05 17:20:22 +02:00
3 changed files with 68 additions and 55 deletions

View File

@@ -3,7 +3,6 @@
LIBDIR=${LIBDIR:-'@libdir@'}
_artixpkg_pkgbase() {
source "${LIBDIR}"/pkg/git/config.sh
source "${LIBDIR}"/pkg/util.sh
ls -1 "${TREE_DIR_ARTIX}" | tr '\n' ' '
}
@@ -17,7 +16,7 @@ _artixpkg_maintainers() {
}
_artixpkg_completion() {
local cur prev comps comps_all repos autorepos teams agents cwords comp_cword_exflag
local cur prev comps comps_all repos autorepos teams agents cwords comp_cword_exflag agent_flag_present
source "${LIBDIR}"/pkg/db/db.sh 2>/dev/null
cur="${COMP_WORDS[COMP_CWORD]}"
@@ -34,6 +33,7 @@ _artixpkg_completion() {
comps_all=""
comp_cword_exflag=0
comp_cword_all=0
agent_flag_present=false
for ((i = 0; i < ${#COMP_WORDS[@]} - 1; i++)); do
word="${COMP_WORDS[i]}"
comps_all+=" $word"
@@ -42,6 +42,10 @@ _artixpkg_completion() {
comps+=" $word"
((comp_cword_exflag++))
fi
if [[ $word == -a || $word == --agent ]]; then
# -a can also refer to --adopt
agent_flag_present=true
fi
done
comps="${comps:1}"
comps_all="${comps_all:1}"
@@ -67,6 +71,13 @@ _artixpkg_completion() {
fi
done
teams="${teams:1}"
agents=""
for word in "${AGENTS[@]}"; do
if [[ $word != -* ]]; then
agents+=" $word"
fi
done
agents="${agents:1}"
case "${comp_cword_exflag}" in
1)
@@ -79,7 +90,7 @@ _artixpkg_completion() {
COMPREPLY=($(compgen -W "maintainer query team topic transfer -h --help" -- ${cur}))
;;
git)
COMPREPLY=($(compgen -W "ci clone config create pull push -h --help" -- ${cur}))
COMPREPLY=($(compgen -W "clone config create pull push -h --help" -- ${cur}))
;;
repo)
COMPREPLY=($(compgen -W "add remove move import show -h --help" -- ${cur}))
@@ -91,37 +102,6 @@ _artixpkg_completion() {
;;
*)
case "${comps}" in
"artixpkg repo add"*)
local repoAddCommon="-p --push -r --rebuild -n --nocheck -h --help"
case "${comp_cword_exflag}" in
3)
COMPREPLY=($(compgen -W "$repoAddCommon $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "$repoAddCommon $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg repo remove"*)
case "${comp_cword_exflag}" in
3)
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-p --push -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg repo move"*)
case "${comp_cword_exflag}" in
3|4)
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-p --push -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg repo import"*)
case "${prev}" in
"--tag")
@@ -136,11 +116,53 @@ _artixpkg_completion() {
"artixpkg repo show")
COMPREPLY=($(compgen -W "-b --base -p --pkgs -h --help" -- ${cur}))
;;
"artixpkg git clone"*)
"artixpkg repo"*)
if [ "$agent_flag_present" = true ] ; then
((comp_cword_exflag--))
fi
case "${prev}" in
"-a"|"--agent")
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
;;
*)
case "${comps}" in
"artixpkg repo add"*)
local repoAddCommon="-p --push -r --rebuild -n --nocheck -a --agent -h --help"
case "${comp_cword_exflag}" in
3)
COMPREPLY=($(compgen -W "$repoAddCommon $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "$repoAddCommon $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg repo remove"*)
case "${comp_cword_exflag}" in
3)
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg repo move"*)
case "${comp_cword_exflag}" in
3|4)
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
esac
;;
esac
;;
"artixpkg git clone"*)
case "${prev}" in
"--protocol")
COMPREPLY=($(compgen -W "https" -- ${cur}))
;;
@@ -155,7 +177,7 @@ _artixpkg_completion() {
COMPREPLY=()
;;
*)
COMPREPLY=($(compgen -W "-m --maintainer --protocol -s --search -t --team -a --agent -j --jobs --all -h --help $(_artixpkg_remotepkgbase ${cur})" -- ${cur}))
COMPREPLY=($(compgen -W "-m --maintainer --protocol -s --search -t --team -j --jobs --all -h --help $(_artixpkg_remotepkgbase ${cur})" -- ${cur}))
;;
esac
;;
@@ -175,14 +197,11 @@ _artixpkg_completion() {
;;
"artixpkg git create"*)
case "${prev}" in
"-a"|"--agent")
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
;;
"-t"|"--team")
COMPREPLY=($(compgen -W "$teams" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-c --clone -a --agent -t --team -h --help" -- ${cur}))
COMPREPLY=($(compgen -W "-c --clone -t --team -h --help" -- ${cur}))
;;
esac
;;
@@ -212,29 +231,19 @@ _artixpkg_completion() {
"-m"|"--maintainer")
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
;;
"-t"|"--topic"|"-j"|"--jobs")
"-t"|"--topic")
# this flag expects a parameter
COMPREPLY=()
;;
*)
COMPREPLY=($(compgen -W "-m --maintainer -t --topic -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg git ci"*)
case "${prev}" in
"-a"|"--agent")
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
COMPREPLY=($(compgen -W "-m --maintainer -t --topic -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg admin maintainer"*)
case "${comp_cword_all}" in
3)
COMPREPLY=($(compgen -W "-a --adopt --o --orphan -h --help" -- ${cur}))
COMPREPLY=($(compgen -W "-a --adopt -o --orphan -h --help" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-h --help $(_artixpkg_pkgbase)" -- ${cur}))
@@ -272,7 +281,7 @@ _artixpkg_completion() {
COMPREPLY=()
;;
*)
COMPREPLY=($(compgen -W "-a --add -r --remove -d --del -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
COMPREPLY=($(compgen -W "-a --add -r --remove -d --delete -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;

View File

@@ -165,7 +165,8 @@ artixpkg_repo_import() {
stat_done
msg2 "Fetching upstream tags"
git fetch --tags upstream main
local fetch
fetch=$(git fetch --tags upstream main &>/dev/null)
local latest version
latest=$(git describe --tags FETCH_HEAD)

View File

@@ -156,6 +156,9 @@ artixpkg_repo_move() {
if [[ "$f" == "${REPO_DB}" ]]; then
git add "$f"
fi
if [[ "$f" == "${REPO_CI}" ]]; then
git add "$f"
fi
done
for f in $(git ls-files --others); do
if [[ "$f" == "${SRCINFO}" ]]; then