diff options
-rw-r--r-- | .zsh.functions/packaging.zsh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/.zsh.functions/packaging.zsh b/.zsh.functions/packaging.zsh index 72627c7..69d6df4 100644 --- a/.zsh.functions/packaging.zsh +++ b/.zsh.functions/packaging.zsh @@ -84,3 +84,50 @@ sshfs_mount() { sshfs_umount() { fusermount3 -u "${HOME}/mounts/$1" } + +nvc() { + local config + 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}" + return 1 + fi + if ! command -v nvchecker > /dev/null; then + 1>&2 printf "The required application 'nvchecker' can not be found.\n" + return 1 + fi + nvchecker -c "${config}" +} + +nvt() { + local config package + 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}" + return 1 + fi + + if [[ -z "$2" ]]; then + 1>&2 printf "A package name needs to be specified as the second argument.\n" + 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}" + return 1 + fi + + if ! command -v nvtake > /dev/null; then + 1>&2 printf "The required application 'nvtake' can not be found.\n" + return 1 + fi + nvtake -c "${config}" "${package}" +} |