aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.config/zsh/functions/packaging.zsh28
1 files changed, 18 insertions, 10 deletions
diff --git a/.config/zsh/functions/packaging.zsh b/.config/zsh/functions/packaging.zsh
index 69d6df4..d8c160c 100644
--- a/.config/zsh/functions/packaging.zsh
+++ b/.config/zsh/functions/packaging.zsh
@@ -104,24 +104,26 @@ nvc() {
}
nvt() {
- local config package
+ local config_file package repo state_dir
if [[ -z "$1" ]]; then
1>&2 printf "A repository name needs to be specified as the first argument.\n"
return 1
fi
- config="${HOME}/.config/nvchecker/$1.toml"
- if [[ ! -f "${config}" ]]; then
- 1>&2 printf "The configuration does not exist: %s\n" "${config}"
+ if [[ -z "$2" ]]; then
+ 1>&2 printf "A package name needs to be specified as the second argument.\n"
return 1
fi
- if [[ -z "$2" ]]; then
- 1>&2 printf "A package name needs to be specified as the second argument.\n"
+ repo="$1"
+ config_file="$HOME/.config/nvchecker/$repo.toml"
+ if [[ ! -f "$config_file" ]]; then
+ 1>&2 printf "The configuration does not exist: %s\n" "$config_file"
return 1
fi
- package="${2}"
- if ! grep "${package}" "${config}" > /dev/null; then
- 1>&2 printf "The package %s can not be found in the configuration: %s\n" "${package}" "${config}"
+
+ package="$2"
+ if ! grep "$package" "$config_file" > /dev/null; then
+ 1>&2 printf "The package %s can not be found in the configuration: %s\n" "$package" "$config_file"
return 1
fi
@@ -129,5 +131,11 @@ nvt() {
1>&2 printf "The required application 'nvtake' can not be found.\n"
return 1
fi
- nvtake -c "${config}" "${package}"
+ nvtake -c "$config_file" "$package"
+
+ state_dir="$HOME/.local/state/nvchecker/"
+ git -C "$state_dir" add "$repo.*.json*"
+ git -C "$state_dir" commit -s -m "Update $package"
+ git -C "$state_dir" pull --rebase
+ git -C "$state_dir" push
}