Skip to content

Commit

Permalink
clipdel: Support getting pattern from standard input
Browse files Browse the repository at this point in the history
  • Loading branch information
ferki committed Oct 27, 2018
1 parent 61c8429 commit 4cd8ffc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clipdel
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -44,7 +45,7 @@ fi

# https://github.com/koalaman/shellcheck/issues/1141
# shellcheck disable=SC2124
raw_pattern=$1
raw_pattern=${1:-$(cat)}
esc_pattern=${raw_pattern/\#/'\#'}

if ! [[ $raw_pattern ]]; then
Expand Down

0 comments on commit 4cd8ffc

Please sign in to comment.