diff --git a/bin/nzb b/bin/nzb new file mode 100755 index 00000000..6bd0bd94 --- /dev/null +++ b/bin/nzb @@ -0,0 +1,26 @@ +#!/bin/bash + +# move to nzb watch + +if [[ + "$#" -ne 1 || ( + "$1" != "movies" && + "$1" != "tv" && + "$1" != "safe" + ) ]]; then + echo "Usage: nzb [movies/tv/safe]" + exit 1 +fi + +target=$1 + +cd ~/Downloads || exit 1 +shopt -s nullglob +nzbs=(*.nzb) +if [ ${#nzbs[@]} -eq 0 ]; then + echo -e "\033[00;31mNo nzbs found\033[0m" +else + for nzb in "${nzbs[@]}"; do + mv $nzb "/Volumes/data/incoming/usenet/watched/$target" + done +fi diff --git a/zsh/completion/_nzb.zsh b/zsh/completion/_nzb.zsh new file mode 100644 index 00000000..4c903743 --- /dev/null +++ b/zsh/completion/_nzb.zsh @@ -0,0 +1,5 @@ +function _nzb { + _arguments '1: :(movies tv safe)' +} + +compdef _nzb nzb