clipmenu

Simple clipboard management using dmenu
git clone https://git.sinitax.com/cdown/clipmenu
Log | Files | Refs | README | LICENSE | sfeed.txt

commit fdf156ef2f8bf960c9c2fe21efddd4a9262486fe
parent 6612ade8b0b04238bd44758a6f34c50c5d25394d
Author: Ferenc Erki <erkiferenc@gmail.com>
Date:   Sat, 27 Oct 2018 22:07:55 +0200

clipdel: Support getting pattern from standard input

Diffstat:
Mclipdel | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/clipdel b/clipdel @@ -19,7 +19,8 @@ lock_timeout=2 if [[ $1 == --help ]] || [[ $1 == -h ]]; then cat << 'EOF' clipdel deletes clipmenu entries matching a regex. By default, just lists what -it would delete, pass -d to do it for real. +it would delete, pass -d to do it for real. If no pattern is passed as an argument, +it will try to read one from standard input. ".*" is special, it will just nuke the entire data directory, including the line caches and all other state. @@ -40,7 +41,12 @@ if ! [[ -f $cache_file ]]; then exit 0 # Well, this is a kind of success... fi -raw_pattern=$1 +if [[ -n $1 ]]; then + raw_pattern=$1 +elif ! [[ -t 0 ]]; then + IFS= read -r raw_pattern +fi + esc_pattern=${raw_pattern//\#/'\#'} # We use 2 separate sed commands so "esc_pattern" matches only the 'clip' text