blob: 3656032a74e001b2da5d3c5efb21aee405b37d62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/usr/bin/env bash
# This is a set of helper bash functions that are too small for their own file,
# but useful enough to be worth `source`ing in your bashrc.
# Faster general searching
function vgsrc() {
case $# in
1)
vgstash list | grep -iE "$1"
;;
2)
vgstash list "$1" | grep -iE "$2"
;;
*)
echo "usage: vgsrc [game name]"
echo " or vgsrc [view name] [game name]"
echo
echo "Ex: vgsrc physical Borderlands"
;;
esac
}
# Faster adding
function vgadd() {
vgstash add "$@"
}
# Shows you a list of *unique* game titles that you have beaten or completed.
# This allows you to weed out the games you own or have beaten on more than one
# platform.
function vgub() {
# TODO: improve
vgstash list -w 80 | head -n 2
vgstash list done -w 80 | sed -e '1,2d' | sort | uniq -w50 | sort -b -t'|' -k 2,2
}
# Shows you the titles of games that you own on more than one system.
function vgmulti() {
vgstash list owned -w 80 | sed -e '1,2d' | sort -b -t'|' -k 1,1 | uniq -d -w50 | cut -d'|' -f 1
}
# Prints the title and system of a random game that you need to beat.
# This tool is great for deciding what to play to knock out the backlog.
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'/'
}
|