config

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

commit 176971b17d20460111988630554503fd5eaedcf6
parent 56217d374902e7d7b62bde7c67cbe81b408ee0d0
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Tue,  2 Feb 2021 01:08:44 -0800

Rewrite the mark script in rc(1) and improve

It no longer depends on my list program (I don't even think it's
public) and handles whitespace in the value if it exists although
it doesn't matter for URLs. Also, it's just more simple and elegant.

Diffstat:
Mmodules/scripts/.local/bin/mark | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/modules/scripts/.local/bin/mark b/modules/scripts/.local/bin/mark @@ -1,10 +1,14 @@ -#!/usr/bin/env dash -#! mark -- select a line from files copying it to the clipboard +#!/usr/local/bin/rc -e +#! mark -- select a line from multiple files via dmenu(1) -set -eu +fn clip { xclip -selection clipboard $* } +fn list { + awk '{ + base = split(FILENAME, path, "/"); + printf "%s:%s\n", path[base], $0 + }' $* +} -xclip() { command xclip -selection clipboard $* ;} -dmenu() { command dmenu -i -w `wid` ;} - -url=`list -b $@ | column -ts" " | dmenu` -echo "$url" | awk '{ print $2 }' | xclip && notify-send "`xclip -out`" +ifs='' +list $* | dmenu -i | cut -d: -f2- | clip -in +exec herbe `{ clip -out } &