Define process_and_extract_urls() to reduce copypastos. - 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 f1c5bb2cb22d6ac7f7f9ac1cd58183fc688adeff
(DIR) parent 5fc4e00ceceb6f92f754c8f88910d3b56f1280fe
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sun, 1 Apr 2018 23:25:50
Define process_and_extract_urls() to reduce copypastos.
Diffstat:
dplumb | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff -r 5fc4e00ceceb -r f1c5bb2cb22d dplumb
--- a/dplumb Sun Apr 01 18:33:26 2018 +0200
+++ b/dplumb Sun Apr 01 23:25:50 2018 +0200
@@ -133,19 +133,23 @@
lines() cat
fi
- if [ "$dplumb_list" = "yes" ]; then
+ #
+ # pipeline to process the lines, urlize words with blank, put one word
+ # per line, urlize word without blanks and extract all URLs.
+ #
+ process_and_extract_urls() {
lines |
urlize_words |
one_word_per_line |
urlize |
extract_urls
+ }
+
+ if [ "$dplumb_list" = "yes" ]; then
+ process_and_extract_urls
else
plumb "$(
- lines |
- urlize_words |
- one_word_per_line |
- urlize |
- extract_urls |
+ process_and_extract_urls |
${PLUMB_DMENU} )"
fi