diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/helpers.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/helpers.sh b/scripts/helpers.sh index b726f0b..69aa59a 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -54,3 +54,27 @@ function vgrand() { local game=$(vgstash list playlog | sed -e '1,2d' | shuf -n 1 --random-source=/dev/random | cut -d '|' -f 1-2 | tr -s ' ' | sed -e 's: | :, for :' -e 's:\s$::') echo "You should play ${game}!" } + +# Filters your vgstash output by system. Depends on awk +function vgsys() { + local f='allgames' + local s='' + case $# in + 1) + # single arg means we want the default filter + s="$1" + ;; + 2) + f="$1" + s="$2" + ;; + *) + echo "USAGE: vgsys [FILTER] SYSTEM" + echo + echo "Show all games from a given system (and optionally, filter)." + echo "Defaults to 'allgames' filter if the argument is missing." + return + ;; + esac + vgstash list $f -w 80 | awk 'BEGIN {FS="|"} $2 ~ /'$s'/' +} |