config

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

commit ceb56c1e834f3b17e4c04994fa998f3f59d9c4e5
parent 7b651fea375559c9bc28fe9e72b360df5d5e4767
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sat, 13 May 2023 16:21:55 -0700

Rewrite urls script

It works a little differently now: it outputs to stdout instead of
grabbing it xgrab making it more generally useful. (You could use
xgrab, or you could use plumb, or something else.) It also doesn't
start in any particular directory, which is a tad less convenient
if you do want to start in etc/urls, but a wrapper script could
always be written.

Also, the file format has changed as described in the script.

Diffstat:
Mlocal/bin/bin/urls | 28+++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/local/bin/bin/urls b/local/bin/bin/urls @@ -1,10 +1,20 @@ -#!/usr/local/plan9/bin/rc -e -# Copyright 2021 Jacob R. Edwards +#!/bin/sh +# Copyright 2021, 2023 Jacob R. Edwards <jacob@jacobedwards.org> +# urls, select urls from url files +# +# The url files are of the format +# +# url [comment] +# +# where the comment can be anything so long as there is whitespace +# between it and the url. It is displayed as +# +# filename [comment] url +# +# in dmenu(1) and will contain only the url in the output. -cd $home^/own/etc/urls - -if (~ $#* 0) - * = * -awk '{ gsub("\\]", "", FILENAME); printf "[%s] %s\n", FILENAME, $0 }' \ - `{ find . -type f | cut -c3- } | dmenu | \ - sed -E 's/^\[[^]]+\] //' | xgrab +walk -f "$@" | xargs awk 'NF { + url = $1 + $1 = "" + print FILENAME, $0, url +}' | dmenu | awk '{print $NF}'