#
+## p : string -> unit
+p() {
+ awk \
+ -v _s="$1" \
+ '
+ BEGIN {_s = tolower(_s)}
+
+ /^[a-zA-Z]/ && tolower($1) ~ _s && NF >= 2 {
+ s = $1
+ p = $NF
+ if (NF == 2) {
+ e = ""
+ u = ""
+ } else if (NF == 3) {
+ e = $2
+ u = ""
+ } else {
+ e = $2
+ u = $3
+ } # TODO What would NF > 4 mean?
+ printf("s:\"%s\", e:\"%s\", u:\"%s\"\n", s, e, u) > "/dev/stderr"
+ printf "%s", p # XXX Intentionally avoiding newline in the result.
+ }
+ ' \
+ ~/._p/p \
+ | xsel -i -b -t 30000
+}
+
## web search
## ws : string -> unit
ws() {
vim -c 'set spell' "$DIR_NOTES/$(date +'%Y_%m_%d--%H_%M_%S%z')--$1.md"
}
-weather() {
- local _weather_location
- case "$1" in
- '') _weather_location="$WEATHER_LOCATION";;
- *) _weather_location="$1"
- esac
- curl "http://wttr.in/$_weather_location?format=v2"
-}
-
_bt_devs_infos() {
# grep's defintion of a line does not include \r, wile awk's does and
# which bluetoothctl outputs