Refactor the logic in plumb to simplify ad-hoc filters. - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
(HTM) hg clone https://bitbucket.org/iamleot/plumb
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset e688c5006a3bf594dfee03672c3d5c9f336c170c
(DIR) parent e20cfbb6555bf2338ab4ff67f5f7c43125d884f3
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 24 Mar 2018 16:45:07
Refactor the logic in plumb to simplify ad-hoc filters.
Put one "word" per line at the beginning and outside the awk script so that the
ad-hoc filters to URL-ize patterns can be simplified.
Simplify a bit the CVE pattern.
Diffstat:
dplumb | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff -r e20cfbb6555b -r e688c5006a3b dplumb
--- a/dplumb Sat Mar 24 16:32:27 2018 +0100
+++ b/dplumb Sat Mar 24 16:45:07 2018 +0100
@@ -31,15 +31,12 @@
: ${PLUMB_DMENU:=dmenu -l 10}
plumb "$(
+tr -s '[:space:]' '\n' |
sed \
- -E -e 's;(^|[[:space:]]+)(CVE-[0-9]+-[0-9]+)([[:punct:]]*|[[:space:]]*|$);cve://\2 ;g' \
+ -E -e 's;^(CVE-[0-9]+-[0-9]+).*$;cve://\1;g' \
-E -e 's;^ar[Xx]iv:;arxiv://;g' |
awk \
'
-BEGIN {
- FS = RS = "[ \t\n]+"
-}
-
/:\/\// {
# Get rid of possible delimiters (<...>, (...), [...])
if (match($0, /\<[0-9A-Za-z]+:\/\/[^>]+\>/) ||