config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 458f5293398525ea3f67e5009901abc8b26e90fa
parent 7f505cf016e40a9c4d3836b3bca49fa67a3bec78
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sat, 27 Mar 2021 00:59:46 -0700

Simplify dalias script and format

It now uses simple `key=value' statements and does no post processing.
This makes it extremely simple to convert into ksh(1) directory
aliases.

Diffstat:
Mlocal/bin/.local/bin/dalias | 21++++++---------------
Mlocal/dalias/.config/dalias | 13++++++-------
Mlocal/ksh/.config/ksh.kshrc | 5+----
3 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/local/bin/.local/bin/dalias b/local/bin/.local/bin/dalias @@ -1,20 +1,11 @@ -#!/bin/sh -e +#!/bin/sh # Copyright 2021 Jacob R. Edwards # License: GPLv3 # -# dalias -- directory alias +# dalias -- 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. +# The dalias script is intended for use with special locations you +# want to mark down but can be used for anything. Example 'h=/home' -if test $# -gt 0; then - filter() egrep "$@" -else - filter() dmenu "$@" -fi - -eval printf '%s\\n' \ `column -ts' ' \ - ${XDG_CONFIG_HOME:-$HOME/.config}/dalias | filter $* | awk '{ print $NF }'` +egrep "^${1:?No alias specified.}=" <${XDG_CONFIG_HOME:-$HOME/.config}/dalias | + cut -d= -f2 diff --git a/local/dalias/.config/dalias b/local/dalias/.config/dalias @@ -1,7 +1,6 @@ -c c projects ~/own/src/c -config stow config ~/own/config -feed rss feeds ${XDG_DATA_DIR:-$HOME/.local/share}/feed -fork software forks ~/own/src/public/etc/fork -m3u mpd m3u playlists ~/.local/var/mpd/m3u -note random notes ~/own/text/note -src programming projects ~/own/src +c=/home/jacob/own/src/c +config=/home/jacob/own/config +fork=/home/jacob/own/src/public/etc/fork +m3u=/home/jacob/.local/var/mpd/m3u +note=/home/jacob/own/text/note +src=/home/jacob/own/src diff --git a/local/ksh/.config/ksh.kshrc b/local/ksh/.config/ksh.kshrc @@ -10,9 +10,6 @@ PS3='3> ' PS4='4> ' mkdir -p "$(dirname $HISTFILE)" -test -f $XDG_CONFIG_HOME/dalias && - eval $(awk -F'\t' '{ printf "alias -d %s=%s;", $1, $3 }' \ - <$XDG_CONFIG_HOME/dalias) - +eval "$(sed 's/^/alias -d /' <"$XDG_CONFIG_HOME/dalias")" . include include aliases cd etc fs hist mpc openbsd private xorg