commit 8cc1c2306b00f6be9bca78f16ea2319a8dbe73f8
parent 292c01268d8a4568cccdb80764cafc50973d9907
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Mon, 15 Feb 2021 11:44:41 -0800
Update dalias script and configuration
The major change was introducing a `name' field so there can be an
exact way of addressing certain entries if needed. Also the `path'
field was put last.
Diffstat:
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/modules/dalias/.config/dalias b/modules/dalias/.config/dalias
@@ -1,14 +1,9 @@
-define(H, $HOME)
-define(OWN, H/own)dnl
-define(SRC, OWN/src)dnl
-define(C, SRC/c)dnl
-define(LOCAL, H/.local)dnl
-/etc/ssh ssh config
-C c projects
-C/net/gawk gopher client
-LOCAL/var/mpd/m3u mpd m3u playlists
-OWN/config stow config
-OWN/text/note random notes
-SRC programming projects
-SRC/awk/kjv2 awk bible processor
-SRC/fork software forks
+ssh /etc/ssh ssh config
+c $HOME/own/src/c c projects
+gawk $HOME/own/src/c/net/gawk gopher client
+m3u $HOME/.local/var/mpd/m3u mpd m3u playlists
+config $HOME/own/config stow config
+note $HOME/own/text/note random notes
+src $HOME/own/src programming projects
+kjv $HOME/own/src/awk/kjv2 awk bible processor
+fork $HOME/own/src/fork software forks
diff --git a/modules/scripts/.local/bin/dalias b/modules/scripts/.local/bin/dalias
@@ -1,10 +1,20 @@
-#!/usr/local/bin/rc -e
+#!/bin/sh -e
# Copyright 2021 Jacob R. Edwards
# License: GPLv3
#
# dalias -- directory alias
+#
+# The dalias script reads directory aliases in the form
+# ``name<tab>description<tab>path'' from ``$XDG_CONFIG_HOME/dalias''
+# and filters them based on your arguments (if there are none,
+# dmenu(1), otherwise egrep(1)) and prints the path, evaluated by
+# sh(1), to the standard output.
+
+if test $# -gt 0; then
+ filter() egrep "$@"
+else
+ filter() dmenu "$@"
+fi
-if (test $#* -eq 0) {
- fn filter { dmenu $* };
-} else fn filter { egrep $* };
-eval printf '%s\n' `{ m4 $XDG_CONFIG_HOME/`{ basename $0 } | column -ts' ' | filter $* | cut -f1 -d' ' }
+eval printf '%s\\n' \ `column -ts' ' \
+ ${XDG_CONFIG_HOME:-$HOME/.config}/dalias | filter $* | awk '{ print $NF }'`