pkgctl repo clone: add option to switch working tree
Add an option to call the switch command after clone. Switch to a specified version. The working tree and the index are updated to match the version. Signed-off-by: Christian Heusel <christian@heusel.eu> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
parent
4289be212b
commit
8e3b6bcc5b
|
@ -262,12 +262,14 @@ _pkgctl_repo_cmds=(
|
|||
|
||||
_pkgctl_repo_clone_args=(
|
||||
-m --maintainer
|
||||
--switch
|
||||
-u --unprivileged
|
||||
--universe
|
||||
-h --help
|
||||
)
|
||||
_pkgctl_repo_clone_args__maintainer_opts() { :; }
|
||||
_pkgctl_repo_clone_args_m_opts() { _pkgctl_repo_clone_args__maintainer_opts; }
|
||||
_pkgctl_repo_clone_args__switch_opts() { :; }
|
||||
_pkgctl_repo_clone_opts() { _devtools_completions_all_packages; }
|
||||
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ _pkgctl_repo_switch_args=(
|
|||
|
||||
_pkgctl_repo_clone_args=(
|
||||
'(-m --maintainer=)'{-m,--maintainer=}'[Clone all packages of the named maintainer]:maintainer:'
|
||||
'--switch=[Switch the current working tree to a specified version]'
|
||||
'--universe[Clone all existing packages, useful for cache warming]'
|
||||
'(-h --help)'{-h,--help}'[Display usage]'
|
||||
'*:packages:_devtools_completions_all_packages'
|
||||
|
|
|
@ -28,6 +28,10 @@ Options
|
|||
*--universe*::
|
||||
Clone all existing packages, useful for cache warming
|
||||
|
||||
*--switch* 'VERSION'::
|
||||
Switch to a specified version. The working tree and the index are updated to
|
||||
match the version.
|
||||
|
||||
*-h, --help*::
|
||||
Show a help text
|
||||
|
||||
|
@ -35,5 +39,6 @@ See Also
|
|||
--------
|
||||
|
||||
linkman:pkgctl-repo-configure[1]
|
||||
linkman:pkgctl-repo-switch[1]
|
||||
|
||||
include::include/footer.asciidoc[]
|
||||
|
|
|
@ -32,12 +32,14 @@ pkgctl_repo_clone_usage() {
|
|||
|
||||
OPTIONS
|
||||
-m, --maintainer=NAME Clone all packages of the named maintainer
|
||||
--switch VERSION Switch the current working tree to a specified version
|
||||
--universe Clone all existing packages, useful for cache warming
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
$ ${COMMAND} libfoo linux libbar
|
||||
$ ${COMMAND} --maintainer mynickname
|
||||
$ ${COMMAND} --switch 1:1.0-2 libfoo
|
||||
_EOF_
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,7 @@ pkgctl_repo_clone() {
|
|||
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
||||
local CLONE_ALL=0
|
||||
local MAINTAINER=
|
||||
local VERSION=
|
||||
local CONFIGURE_OPTIONS=()
|
||||
local pkgbases
|
||||
|
||||
|
@ -77,6 +80,19 @@ pkgctl_repo_clone() {
|
|||
MAINTAINER="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--switch)
|
||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||
# shellcheck source=src/lib/repo/switch.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/switch.sh
|
||||
VERSION="$2"
|
||||
shift 2
|
||||
;;
|
||||
--switch=*)
|
||||
# shellcheck source=src/lib/repo/switch.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/switch.sh
|
||||
VERSION="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--universe)
|
||||
CLONE_ALL=1
|
||||
shift
|
||||
|
@ -137,5 +153,9 @@ pkgctl_repo_clone() {
|
|||
fi
|
||||
|
||||
pkgctl_repo_configure "${CONFIGURE_OPTIONS[@]}" "${pkgbase}"
|
||||
|
||||
if [[ -n "${VERSION}" ]]; then
|
||||
pkgctl_repo_switch "${VERSION}" "${pkgbase}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue